meandf is a program that allows you to create two sample means, based on two different randomizing methods. The resulting means are subtracted and compared to zero. The program displays an upper and lower limit with 95 percent confidence for the difference between the means.
The purpose of this program is to show that, no matter which method you use for generating random numbers, the result is a normal distribution.
The following three methods are used for generating the test data:
You choose any two from these three methods. You also choose a probability below which the test is valid. And you choose the number of observations that you test.
The program adds up the number of successes for each method and divides by the number of observations to get a proportion close to the population probability. Each mean has its own randomizing seed. Both seeds are initialized to the same value. However, the seeds do not remain in sync, because the randomizing methods are different for each mean.
meandf has the following parameters:
If the -f parameter is used, the first mean is always for -f, and the second mean is for either -n or -b.
Otherwise, the first mean is always for -n, and the second mean is always for -b.
Examples of how to run the program.
meandf -f -b 20 -p 0.5 -s 10000 -c 95.0
meandf -f -n 1000 -p 0.5 -s 10000 -c 95.0
meandf -n 1000 -b 20 -p 0.5 -s 10000 -c 95.0
In these examples, the program makes 10 thousand observations for success with a probability of 50 percent and a confidence level of 95 percent.
The probability parameter should give the program a fair chance of success for each observation. The following table shows examples of fair and unfair probabilities.
Parameter | Probability | Fair? |
---|---|---|
-n 20 | -p 0.13 | No |
-n 20 | -p 0.25 | Yes |
-b 8 | -p 0.4 | No |
-b 8 | -p 0.25 | Yes |
The following formulas show how the meandf program calculates the z score for this test.
Enlarged View Postscript (Page 1)
Enlarged View Postscript (Page 2)
The calculation of probabilities for the sample mean distribution is based on the following book:
Lincoln L. Chao
Statistics for Management
2nd Edition
Palo Alto: The Scientific Press, 1984
Chapter 9, Statistical Estimation
Section 3, Interval Estimation About Proportions
Lincoln L. Chao published his book while at California State University, Long Beach.