Sampling Distribution Simulator

Simulate repeated samples to see standard error and Central Limit Theorem behavior.

Results are calculated automatically as you enter data.

Whole-number limits and probabilities are validated strictly; invalid entries are not silently changed.

Formula and interpretation
Standard errorRun a simulation to view the sampling distribution.

▼ See explanations and tips below ▼

What Is a Sampling Distribution?

A sampling distribution is the distribution of a statistic over many repeated samples of the same size. Instead of looking at the distribution of individual data values, a sampling distribution looks at values such as sample means or sample proportions that come from repeated samples.

For example, imagine drawing many samples of size \(n\) from the same population. For each sample, you calculate the sample mean \(\bar{x}\). The collection of all those sample means forms a sampling distribution of the sample mean. If you calculate a sample proportion \(\hat{p}\) each time instead, the collection of those proportions forms a sampling distribution of the sample proportion.

This idea matters because a single sample statistic can vary just by chance. A sampling distribution helps show how much variation to expect when the sampling process is repeated.


Why Sampling Distributions Matter

Sampling distributions are one of the foundations of statistical inference. They explain why one sample estimate may be close to the population value while another sample estimate may be farther away.

They are useful because they help answer questions such as:

  • How much should sample means vary from sample to sample?
  • How much should sample proportions vary from poll to poll?
  • What happens to sampling variability when sample size increases?
  • When is a normal approximation a reasonable model for sample statistics?
  • Why is the standard error smaller for larger samples?

A sampling distribution also helps separate two different ideas: the variability of individual population values and the variability of sample statistics. A population can be very spread out, while the sample mean from a reasonably large sample may be much less variable.


Key Terms to Know

  • Population: The full group or process being studied.
  • Sample: A subset of observations drawn from the population.
  • Statistic: A number calculated from a sample, such as a sample mean or sample proportion.
  • Parameter: A number that describes the population, such as the population mean \(\mu\), population standard deviation \(\sigma\), or population proportion \(p\).
  • Sampling distribution: The distribution of a statistic across repeated samples of the same size.
  • Standard error: The standard deviation of a sampling distribution. It describes the typical sampling variability of a statistic.
  • Sample mean: The average of the values in one sample, usually written as \(\bar{x}\).
  • Sample proportion: The fraction of observations in one sample that have a selected outcome, usually written as \(\hat{p}\).
  • Bernoulli variable: A 0/1 variable where 1 represents success and 0 represents failure.
  • Central limit theorem: A result explaining why sample means, and many sample proportions under suitable conditions, become approximately normal as sample size becomes large.

How Sampling Distributions, Standard Error, and the Central Limit Theorem Work

The basic process is simple:

  1. Draw a sample of size \(n\).
  2. Calculate a statistic, such as the mean or proportion.
  3. Repeat the sampling process many times.
  4. Plot or summarize the repeated statistic values.

The repeated statistic values usually cluster around the population value they estimate. For sample means, the center is near the population mean. For sample proportions, the center is near the population proportion. The spread of the sampling distribution is called the standard error.

For a sample mean, when the population standard deviation is \(\sigma\), the theoretical standard error is:

$$ SE_{\bar{x}} = \frac{\sigma}{\sqrt{n}} $$

Where:

  • \(SE_{\bar{x}}\) is the standard error of the sample mean.
  • \(\sigma\) is the population standard deviation.
  • \(n\) is the sample size.

For a sample proportion from Bernoulli 0/1 data, the theoretical standard error is:

$$ SE_{\hat{p}} = \sqrt{\frac{p(1 - p)}{n}} $$

Where:

  • \(SE_{\hat{p}}\) is the standard error of the sample proportion.
  • \(p\) is the population proportion or success probability.
  • \(n\) is the sample size.

Both formulas show the same important pattern: increasing \(n\) reduces standard error. The reduction is not one-for-one, because sample size appears inside a square root. To cut the standard error in half, the sample size must be about four times as large, assuming the population spread or proportion stays the same.

The central limit theorem explains the shape of many sampling distributions. When observations are independent and the sample size is large enough, the sampling distribution of the sample mean tends to become approximately normal, even if the original population is not normal. The approximation may be less reliable for very small samples, highly skewed populations, or populations with extreme outliers. For proportions, the approximation also depends on having enough expected successes and failures.


Examples of Sampling Distributions in Practice

Example 1: Standard Error of a Sample Mean

Suppose a population has a mean of \(50\) and a population standard deviation of \(12\). If repeated samples of size \(36\) are drawn, the standard error of the sample mean is:

$$ SE_{\bar{x}} = \frac{12}{\sqrt{36}} $$

Since \(\sqrt{36} = 6\):

$$ SE_{\bar{x}} = \frac{12}{6} = 2 $$

This means the sample means would typically vary around the population mean with a standard deviation of about \(2\). It does not mean individual values vary by only \(2\); the individual population values still have a standard deviation of \(12\).


Example 2: Standard Error of a Sample Proportion

Suppose the true population proportion is \(p = 0.35\), and each sample has size \(100\). The standard error of the sample proportion is:

$$ SE_{\hat{p}} = \sqrt{\frac{0.35(1 - 0.35)}{100}} $$
$$ SE_{\hat{p}} = \sqrt{\frac{0.35 \times 0.65}{100}} $$
$$ SE_{\hat{p}} = \sqrt{0.002275} \approx 0.0477 $$

So sample proportions would tend to vary around \(0.35\) with a standard error of about \(0.0477\). If the sample size increased to \(200\), the standard error would become:

$$ SE_{\hat{p}} = \sqrt{\frac{0.35(1 - 0.35)}{200}} \approx 0.0337 $$

The larger sample gives a narrower sampling distribution.


Example 3: A Small Sample from a Skewed Population

A skewed population can produce a sampling distribution that still looks skewed when the sample size is small. If samples of size \(5\) are repeatedly drawn from a strongly right-skewed population, some sample means may be pulled upward by unusually large values.

As \(n\) increases, the sampling distribution of the mean often becomes more bell-shaped and more concentrated around the population mean. However, \(n = 30\) is only a rough classroom rule of thumb, not a guarantee. Severe skewness, outliers, or dependence between observations can require larger samples before a normal approximation is useful.


How to Interpret the Result

The theoretical standard error is the formula-based expected spread of the sampling distribution. A smaller standard error means the sample statistic tends to vary less from sample to sample. A larger standard error means the sample statistic is more variable.

Theoretical values come from the selected mathematical model, so changing only the random seed or the number of repetitions does not change them. Those controls affect the Monte Carlo sample, simulated histogram, and simulated summaries only.

The simulated standard deviation is the observed spread of the simulated sample statistics. With many repeated samples, the simulated standard deviation should often be close to the theoretical standard error, but it does not have to match exactly. Simulation randomness, sample size, and the shape of the population can all affect the match.

The simulated mean of the sample statistics should usually be close to the population mean or population proportion. Small differences are expected because a simulation uses a finite number of repeated samples.

For sample means, the normal curve uses the same density scale as the histogram. It is exact for the ideal normal population and otherwise serves as a CLT reference. For Bernoulli proportions, the graph compares simulated probability masses with the exact binomial distribution and shows a continuity-corrected normal reference only when expected-success and expected-failure conditions are met.

For proportions, results are shown as decimals, not percentages. A proportion of \(0.35\) means \(35\%\), and a standard error of \(0.0477\) is about \(4.77\) percentage points.


Common Mistakes and Misconceptions

  • Confusing population standard deviation with standard error: Population standard deviation describes the spread of individual values. Standard error describes the spread of sample statistics.
  • Thinking repeated samples change the theoretical standard error: More simulation repetitions make the histogram more stable, but they do not change the theoretical standard error for a fixed population and sample size.
  • Entering percentages instead of decimal probabilities: A Bernoulli probability should be entered as a decimal, such as \(0.35\), not \(35\).
  • Treating the normal overlay as exact: The normal curve is an approximation aid. It can be poor for small samples, highly skewed distributions, or proportions near 0 or 1.
  • Assuming \(n = 30\) is a universal rule: A sample size of 30 is a common rule of thumb for many introductory examples, but the needed sample size depends on the population shape and the statistic.
  • Forgetting that samples are drawn with replacement: With-replacement sampling does not use a finite population correction.
  • Expecting proportion mode for non-Bernoulli data: A sample proportion is naturally based on 0/1 outcomes, so proportion mode uses a Bernoulli population.
  • Rounding too early: Rounding intermediate values can make the final standard error slightly different. Keep several decimal places during calculations.

When to Use Sampling Distributions

Use sampling distributions when you want to understand how a statistic behaves across repeated samples. They are especially useful for:

  • Learning why sample estimates vary.
  • Comparing the spread of sample means and sample proportions.
  • Seeing why larger samples usually give more precise estimates.
  • Understanding the standard error behind confidence intervals and hypothesis tests.
  • Exploring when a normal approximation is reasonable.
  • Teaching or studying the central limit theorem through simulation.

Sampling distributions are also useful in real research settings, but real data analysis requires careful attention to study design, independence, measurement quality, and whether the sample represents the population of interest.


Limitations and Things to Keep in Mind

This calculator samples directly from built-in mathematical population models. Theoretical means, standard deviations, and standard errors come from those model parameters; the independent population preview is used only for visualization. It does not analyze user-entered datasets, uploaded data, or custom distributions.

Samples are drawn with replacement. That means each draw is made as if the population is restored before the next draw. Sampling without replacement and finite population correction are not included.

Only the sample mean and sample proportion are supported. Other statistics, such as the median, variance, standard deviation, quantiles, or custom statistics, are not calculated.

The sample size is limited to integers from \(1\) through \(200\). The number of repeated samples is limited to integers from \(100\) through \(20{,}000\). Fractional, blank, or out-of-range entries produce validation errors rather than being truncated or clamped. Bernoulli probabilities from \(0\) through \(1\) are supported, including degenerate endpoint distributions.

Most displayed numerical results are rounded to a limited number of decimal places. The theoretical standard error, summary values, and table values are shown with up to eight decimal places, while the population center is shown with up to five decimal places.

The graphs are educational tools. The proportion graph includes an exact binomial reference, while nonnormal sample-mean overlays remain CLT references. The calculator does not provide confidence intervals, hypothesis tests, p-values, or professional statistical advice. For important decisions, check assumptions independently and consult a qualified professional when needed.


How to Use This Calculator

  1. Choose the population distribution you want to simulate.
  2. Choose whether to study the sample mean or sample proportion.
  3. For a Bernoulli or proportion simulation, enter the probability \(p\) as a decimal between \(0\) and \(1\).
  4. Enter the sample size \(n\).
  5. Enter the number of repeated samples.
  6. Optionally change the random seed to reproduce the same simulation or generate a different one.
  7. Run the simulation or update the inputs to rerender the result.
  8. Compare the simulated standard deviation with the theoretical standard error.
  9. Use the graph to compare the population preview, latest sample, simulated sampling distribution, and the correctly scaled theoretical reference.

Frequently Asked Questions

What is the difference between a population distribution and a sampling distribution?

A population distribution shows the values of individual observations in the population. A sampling distribution shows the values of a statistic, such as a sample mean or sample proportion, across repeated samples. The sampling distribution is usually narrower than the population distribution for sample means because averaging reduces variability.


What does standard error mean?

Standard error is the standard deviation of a sampling distribution. It describes how much a sample statistic tends to vary from sample to sample. A smaller standard error means the statistic is usually more stable across repeated samples.


Why does increasing sample size reduce standard error?

For sample means, the standard error is \(\sigma / \sqrt{n}\). For sample proportions, the standard error is \(\sqrt{p(1-p)/n}\). In both formulas, increasing \(n\) increases the denominator, which makes the standard error smaller.


Does increasing the number of repeated samples reduce the theoretical standard error?

No. The theoretical standard error depends on the population spread or proportion and the sample size \(n\). Increasing the number of simulation repetitions mainly makes the simulated histogram and simulated standard deviation more stable.


Why is the sample proportion related to Bernoulli 0/1 data?

A sample proportion can be viewed as the mean of 0/1 values, where 1 means success and 0 means failure. For example, if 35 out of 100 observations are successes, the mean of the 0/1 values is \(35/100 = 0.35\), which is also the sample proportion.


Is the central limit theorem always reliable for \(n \ge 30\)?

No. \(n \ge 30\) is a useful introductory rule of thumb, but it is not a universal guarantee. The quality of a normal approximation depends on the population shape, outliers, independence, and, for proportions, whether there are enough expected successes and failures.


What does the random seed do?

The random seed controls the pseudo-random sequence used in the simulation. Using the same seed with the same inputs should reproduce the same simulation behavior. Changing the seed lets you see another possible set of repeated samples.


Sources and References

Books

  1. Barbara Illowsky and Susan Dean. Introductory Statistics 2e. OpenStax, 2023. Chapter 7.1, “The Central Limit Theorem for Sample Means (Averages).” OpenStax section.
  2. Alexander Holmes, Barbara Illowsky, and Susan Dean. Introductory Business Statistics 2e. OpenStax, 2023. Section 7.3, “The Central Limit Theorem for Proportions.” OpenStax section.
  3. David Diez, Mine Çetinkaya-Rundel, and Christopher Barr. OpenIntro Statistics. 4th ed., OpenIntro, 2019. Sections on the central limit theorem, sampling variability, and sample proportions. OpenIntro book page and Section 5.1 PDF.

Online and Educational Sources

  1. Penn State Eberly College of Science. “4.1 - Sampling Distributions.” STAT 200, accessed July 4, 2026. Course page.