-
Notifications
You must be signed in to change notification settings - Fork 1
Sample_size
This program tells you which is the minimum number of measurements on a variable that should be done in order to have a mean measurement within ar%
(by default,1%
). However, you must be consciuous that you might be very unlucky and the samples you take are not representative at all of the stochastic process. This risk is taken with probability alpha (by default,0.5%
). The only drawback of this method is that you need a starting estimation of the process average and standard deviation. The implemented problem is the following: given a processY
, andn
samples from it (y
), find the minimumn
for which
Pr(ABS(mean(y)-mean(Y))/ABS(Y)>=r)<=alpha
It comes out that the solution is
n>=((t*stddev(y))/(r*mean(y)))^2
wheret
is the value for which
Pr(z>=t)<=alpha
in a_Normal(0,1)_ distribution.
$ sample_size ...
Parameters
- ``
-
-alpha [alpha
0.005] = -
-r [r
0.01] =
How many samples do I need from a population with mean 0.15 and standard deviation 0.05, to be sure that 0.15 is within a 1?
$ sample_size -stats 0.15+-0.05 -r 0.01 -alpha 0.005
You should take at least 8750.96 samplesThis comes from the fact that the standard deviation is large compared to the mean value and you are very restrictive with the mean conditions. If we wanted our computed mean to be within a 5.
$ sample_size -stats 0.15+-0.05 -r 0.05 -alpha 0.01
Then only 295.13 samples must be taken.
--Main.AlfredoSolano - 31 Jan 2007