matching from a distribution

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 Kommentare

Oleg Komarov
Oleg Komarov am 3 Jul. 2011
What's x and Y?
Danielle Leblanc
Danielle Leblanc am 3 Jul. 2011
sorry. x is A . it is the 1000 and Y is B. I forgot that i named them A and B and I named them x and y instead
Danielle Leblanc
Danielle Leblanc am 3 Jul. 2011
i edited the question. now it is clearer
Danielle Leblanc
Danielle Leblanc am 3 Jul. 2011
i edited the question. now it is clearer

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Oleg Komarov
Oleg Komarov am 3 Jul. 2011

0 Stimmen

[I]
idx = B > A + .1*A | B < A + .1*A;
B(idx)

2 Kommentare

Danielle Leblanc
Danielle Leblanc am 3 Jul. 2011
I think you mean:
idx = B > A - .1*A | B < A + .1*A;
B(idx)
Oleg Komarov
Oleg Komarov am 4 Jul. 2011
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.

Melden Sie sich an, um zu kommentieren.

Danielle Leblanc
Danielle Leblanc am 4 Jul. 2011

0 Stimmen

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)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 3 Jul. 2011

Community Treasure Hunt

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

Start Hunting!

Translated by