Why Simulate Proportion Distributions?
A sample proportion varies from sample to sample, even when every sample is drawn from the same population. A simulation makes that variation visible: repeatedly draw samples, calculate a proportion for each one, and examine the resulting collection of proportions. Repeating the process at several sample sizes helps show what changes when each sample contains more observations.
To make a fair comparison, keep the population and sampling method fixed. In this tutorial, the hypothetical population has two outcomes: success and failure. A randomly selected individual is a success with probability \(p=0.40\), and each draw is made with replacement. Thus the chance of success is the same on every draw, including when a sample is larger.
For one simulated sample, if \(X\) is the number of successes among its \(n\) observations, its sample proportion is
The simulation produces \(R\) values, which we can label \(\hat{p}_1,\hat{p}_2,\ldots,\hat{p}_R\). Their average describes the simulated center, and their sample standard deviation describes the simulated spread:
Here \(\bar{\hat{p}}\) is the average of the \(R\) simulated proportions. It is a summary of the simulation output, not the population proportion itself. In this model, the theoretical center is \(p=0.40\), and the standard deviation of the sampling distribution is \(\sqrt{p(1-p)/n}\). These provide benchmarks for judging the simulation; finite simulation results will not generally match them exactly.
Building a Simulation
One simple way to simulate a binary outcome is to generate a random number uniformly between 0 and 1 for each draw. Record a success if the number is at most 0.40, and a failure otherwise. Repeating this rule generates outcomes with the required success probability. To simulate one sample, repeat the draw rule \(n\) times; to simulate the distribution, repeat the whole sample-generation process \(R\) times.
Set the success probability, the sample size \(n\), and the sampling rule. Here \(p=0.40\), and draws are independent because sampling is with replacement.
Draw \(n\) binary outcomes using the same success rule for every draw.
Count the successes \(X\), then calculate \(\hat{p}=X/n\).
Repeat steps 2 and 3 for \(R\) samples. Compare the resulting center, spread, and histogram with those from other sample sizes.
For a comparison across sample sizes, hold \(p\), the sampling rule, and \(R\) fixed, and change only \(n\). The repeated runs are simulated versions of repeated sampling, not additional observations combined into one large sample. Each run produces its own proportion.
Worked Example: Simulating One Sample
Suppose ten hypothetical uniform random numbers generated for a sample are 0.12, 0.83, 0.27, 0.56, 0.39, 0.91, 0.04, 0.68, 0.31, and 0.47. Under the rule that a number at most 0.40 represents a success, find the sample proportion.
The successes correspond to 0.12, 0.27, 0.39, 0.04, and 0.31. There are \(X=5\) successes in \(n=10\) draws, so
This particular sample has a success proportion of 0.50, which is above the population value \(p=0.40\). That difference is ordinary sample-to-sample variation. It does not mean the simulation rule changed the population proportion.
Summarizing Repeated Simulations
A single simulated sample shows one possible outcome, but the collection of many samples is what reveals the distribution. For example, suppose six simulated samples of size 10 produce success counts 2, 3, 3, 4, 4, and 5. Dividing each count by 10 gives six simulated proportions. We can calculate their average and spread just as we would for any list of quantitative values.
Worked Example: Finding the Center and Spread of Six Runs
For the six samples with success counts 2, 3, 3, 4, 4, and 5, the simulated proportions are 0.20, 0.30, 0.30, 0.40, 0.40, and 0.50. Calculate their average and sample standard deviation.
The average is
The deviations from 0.350 are \(-0.150,-0.050,-0.050,0.050,0.050,\) and \(0.150\). Squaring and adding them gives \(0.0225+0.0025+0.0025+0.0025+0.0025+0.0225=0.0550\). Therefore,
The simulated center, 0.350, differs from the model value 0.40, and the simulated spread is about 0.1049. With only six repetitions, both summaries can be quite variable. A small number of simulated samples is not enough to expect the summaries to closely match their theoretical benchmarks.
Comparing Sample Sizes
Under the fixed model with \(p=0.40\), the sampling distribution has center \(p\) and standard deviation \(\sqrt{p(1-p)/n}\). Increasing \(n\) therefore leaves the benchmark center unchanged while reducing the benchmark spread. Simulation provides a visual and numerical check of these patterns. The particular simulated values fluctuate, so the center need not equal 0.40 exactly and the simulated standard deviation need not equal its benchmark exactly.
The next example uses 500 simulated samples at each of three sample sizes. The figures are hypothetical simulation output, rounded to four significant figures. Their small differences from the benchmarks are plausible simulation variation.
Worked Example: Comparing Three Sample Sizes
A simulation uses the same success probability \(p=0.40\) and the same with-replacement sampling rule for \(n=10\), \(n=40\), and \(n=160\). For each sample size, it generates \(R=500\) samples and records the 500 resulting proportions. The summary output is:
| Sample size \(n\) | Simulated mean | Simulated standard deviation | Theoretical standard deviation |
|---|---|---|---|
| 10 | 0.4018 | 0.1552 | 0.1549 |
| 40 | 0.3991 | 0.07780 | 0.07746 |
| 160 | 0.4004 | 0.03840 | 0.03873 |
For \(n=40\), the theoretical standard deviation is
The simulated mean for \(n=40\) is 0.3991, close to the model center 0.40, and its simulated standard deviation, 0.07780, is close to the benchmark 0.07746. These are summaries of the 500 simulated proportions. They do not describe the spread of individual binary outcomes.
Across the three rows, the simulated centers remain close to 0.40. The simulated standard deviations decrease as \(n\) increases, and they are close to the corresponding benchmarks. In particular, increasing \(n\) from 10 to 40 multiplies the sample size by four; the theoretical standard deviation is approximately halved, from 0.1549 to 0.07746. Increasing \(n\) from 40 to 160 again multiplies the sample size by four, and again approximately halves the benchmark spread.
Reading the Shapes of Simulated Distributions
A histogram of the simulated proportions adds information that the mean and standard deviation alone cannot show. Use the same horizontal scale when comparing sample sizes. Then a narrower distribution is visibly narrower in proportion units, rather than appearing narrow only because the graph's scale changed. Keep the population probability fixed as well, so that the comparisons isolate the effect of changing \(n\).
Sample proportions are discrete: in one sample of size \(n\), the success count must be an integer from 0 to \(n\). Therefore the possible proportions are \(0/n,1/n,\ldots,n/n\), and adjacent possible values differ by \(1/n\). For example, with \(n=10\), the grid spacing is 0.1; with \(n=40\), it is 0.025. This follows directly by subtracting proportions for consecutive success counts:
Thus, a larger sample size gives more possible proportion values and finer spacing, while its sampling distribution is also less spread out. A histogram with a small number of simulated runs may look uneven simply because there are few runs to display. Increasing \(R\) tends to make the histogram a more stable depiction of the model's sampling distribution; it does not itself make each sample proportion less variable.
For the fixed population used here, compare histograms on one common horizontal axis centered near 0.40. At \(n=10\), the proportions can only fall at tenths, so the histogram has relatively coarse possible locations. At larger \(n\), the possible locations are more closely spaced, and the distribution is more concentrated near its center. The simulated shape is still subject to random variation, especially when the number of repetitions is limited.
Why the Comparison Matters
Simulation is useful when a theoretical description feels abstract or when we want to check how the model behaves in repeated samples. It lets us see the variability that remains even when the population is fixed and the sampling process is repeated consistently. It also makes a crucial distinction visible: increasing the sample size changes the distribution of individual sample proportions, whereas increasing the number of repetitions improves how clearly the simulation displays that distribution.
Always report the model and the simulation settings alongside the output: the population success probability, how sampling was performed, the sample sizes, and the number of repetitions. Without these details, a simulated mean or histogram cannot be interpreted reliably. Simulation output is evidence about a specified model, not a substitute for stating what the model assumes.
Common Mistake
Wrong reasoning: “The simulation used 500 repetitions, so each simulated sample effectively has 500 observations and the proportions should have much smaller spread.”
Correction: Each repetition is a separate sample of size \(n\), and its proportion is calculated from that sample alone. The 500 repetitions provide 500 values with which to summarize the distribution. They do not change the sample size within a run. To reduce the model's standard deviation of sample proportions, increase \(n\); to stabilize the simulation's estimated summaries, increase \(R\).
Check Your Understanding
Use the model and ideas in this tutorial to answer the following questions.
- A binary population has success probability 0.30. Describe one rule for generating a single outcome from a uniform random number between 0 and 1.
- In a sample of size 25, there are 9 successes. Calculate the sample proportion and state what it summarizes.
- Why should the simulated center remain near the same value when the sample size changes but the population remains fixed?
- For a fixed sample size, what does increasing the number of simulated repetitions change, and what does it not change?
- Explain why a histogram of proportions from samples of size 20 has more widely spaced possible values than one from samples of size 100.