http://www.mathworks.com/matlabcentral/newsreader/view_thread/244063
MATLAB Central Newsreader  sampling from a set based on a condition
Feed for thread: sampling from a set based on a condition
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Sun, 08 Feb 2009 10:20:02 +0000
sampling from a set based on a condition
http://www.mathworks.com/matlabcentral/newsreader/view_thread/244063#626935
enviro leader
question is how to select a sample from a set while the sample variance is maximum?<br>
<br>
I want to select a sample of 50 from a while the selected sample has the maximum variance<br>
<br>
a=magic(500);a=a(:,1);<br>
b50=?

Sun, 08 Feb 2009 18:57:02 +0000
Re: sampling from a set based on a condition
http://www.mathworks.com/matlabcentral/newsreader/view_thread/244063#626966
Roger Stafford
"enviro leader" <farhadnejadkoorki@yahoo.co.uk> wrote in message <gmmbki$f07$1@fred.mathworks.com>...<br>
> question is how to select a sample from a set while the sample variance is maximum?<br>
> <br>
> I want to select a sample of 50 from a while the selected sample has the maximum variance<br>
> <br>
> a=magic(500);a=a(:,1);<br>
> b50=?<br>
<br>
How about selecting the 25 largest and the 25 smallest numbers from 'a'? If these two groups lie on opposite sides of their own mean, you already have the maximum variance. If your set is so skewed that, say, two of these 25 largest happen to lie below their mean, then discard them and add two of the smallest to the sample. Something like that procedure should very quickly get you to the maximum sample variance.<br>
<br>
One thing you can be absolutely sure of. For some number n in 1<=n<=49, if you select the largest n and the smallest 50n from among the 500, you will attain the maximum sample variance. Very likely this number n will be at or near 25. If necessary you could try all 49 values for n.<br>
<br>
As a matter of curiosity, why would you want to do a thing like that?<br>
<br>
Roger Stafford