matching from a distribution

조회 수: 2 (최근 30일)
Danielle Leblanc
Danielle Leblanc 2011년 7월 3일
I am a new user and I hope my question is not too sample.
I have a value A=1000; and i have a huge vector B . From B I want to select the observations that : 1. are 10% away from A in either direction (+ and - 10% of A) 2. select the matching values that fall in the same tercile of A (i.e where A falls in the 33.33% of the distribution of the values of B).
How can I do so without writing long programs. I feel a couple of lines by an expert can do the job.
  댓글 수: 4
Danielle Leblanc
Danielle Leblanc 2011년 7월 3일
i edited the question. now it is clearer
Danielle Leblanc
Danielle Leblanc 2011년 7월 3일
i edited the question. now it is clearer

댓글을 달려면 로그인하십시오.

답변 (2개)

Oleg Komarov
Oleg Komarov 2011년 7월 3일
[I]
idx = B > A + .1*A | B < A + .1*A;
B(idx)
  댓글 수: 2
Danielle Leblanc
Danielle Leblanc 2011년 7월 3일
I think you mean:
idx = B > A - .1*A | B < A + .1*A;
B(idx)
Oleg Komarov
Oleg Komarov 2011년 7월 4일
For A = 1000, your formulation detects B > 900 and B < 1100 which means values in between, but you said away in both directions from A, which I interpret outside of the confidence intervals.

댓글을 달려면 로그인하십시오.


Danielle Leblanc
Danielle Leblanc 2011년 7월 4일
The solution for the 1st problem proposed by oleg is wrong. I think it should be : idx = B > A - .1*A & B < A + .1*A; B(idx)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by