13 Testing Two Population Proportions

13.5 Simulation of Differences of Sample Proportions - Optional

The purpose of this section is to observe the behavior of p^1-p^2 under circumstances in which it is reasonable to use a normal distribution to approximate p-values or to build confidence intervals. Suppose two large populations have population proportions p1=0.4 and p2=0.55, respectively. From population 1, we will simulate taking samples of size 100, and from population 2, simulated samples of size 200 will be drawn. Thus, we should observe normal-like behavior of p^1-p2^.

Using Excel’s random number generator, simulate taking 1,000 samples of size 100 from population 1, as in Figure 13.7. (Recall that Bernoulli trials are random events where the outcomes are either 0’s or 1’s, with the probability of observing a 1 a fixed value of p for each trial.)

Figure 13.7: Setup for Simulating Samples from Population 1

Similarly, simulate 1,000 samples of size 200 from population 2, as shown in Figure 13.8. It is convenient to place the samples a fews rows below the samples from population 1.

Figure 13.8: Samples from Population 2

Compute p^1 and p^2 for the first two simulated samples, as in Figure 13.9.

Figure 13.9: p1^ and p^2

Then compute p^1-p^2 for the first pair of samples, then copy the three adjacent commands across for all of the samples, as in Figure 13.10.

Figure 13.10: Computing p^1-p^2

If you create a histogram for the differences p^1-p^2, you’ll observe a bell-shaped distribution centered at p1-p2=-0.15, as in 13.11.

Figure 13.11: Frequency Histogram for p^1-p^2

Further study of the simulated differences will add evidence that the differences p^1-p^2 have an approximate normal distribution.

Exercise - Optional

Pick values for p1 and p2 for two populations, then choose samples sizes n1 and n2 so that a normal distribution model is appropriate for P^1-P^2. Simulate a large number of p^1-p^2’s, and then show that the distribution of the simulated differences is approximately bell-shaped and centered at p1-p2.