Skip to main content

Simulation and Statistical Inference

Two equally well-run samples can report different percentages. How large a difference should we expect from chance alone? We will simulate a sampling distribution and then use random assignment to compare an observed difference with a no-effect model.

  • Simulation-based inference: Using repeated simulations under an assumed model to assess how unusual an observed statistic is.

Core ideas​

Repeated sampling​

Simulate samples of the same size under a stated model and compute the same statistic for each. The spread shows how much the statistic can vary across samples.

Margin of error​

Use the simulated sampling distribution to estimate a range of sampling error. With the same design, larger samples generally give a narrower range.

Randomization​

Shuffle treatment labels under the assumption of no treatment effect. If results at least as extreme as the observed difference occur rarely, that difference is unusual under the assumption.

Essential sampling example​

Assume a population support rate of one half and a simple model of 100 independent responses per sample. For each simulated sample, generate 100 yes-or-no responses with equal probabilities and record the proportion of yes answers. Repeat many times under the same assumptions. The result is a sampling distribution, a distribution of sample statistics rather than individual responses.

For this model, the standard deviation of the sample proportion is

0.5(1−0.5)100=0.05.\sqrt{\frac{0.5(1-0.5)}{100}}=0.05.

A normal approximation places about 95 percent of the proportions within about 1.96(0.05)=0.0981.96(0.05)=0.098 of 0.50.5. A simulation should show a similar spread when it has enough repeats. At sample size 400, the standard deviation becomes 0.0250.025, giving a narrower range. The model predicts sampling variation, while bias from a poorly chosen sample requires a different check.

Essential randomization example​

Suppose an experiment randomly assigns two groups and the new tool's mean score exceeds the comparison group's by six points. To model no treatment effect, hold the observed scores fixed and shuffle the treatment labels using the original assignment rule. For each shuffle, calculate the difference in group means.

If 30 of 1,000 hypothetical shuffles give an absolute difference of at least six points, the estimated two-sided tail proportion is 30/1000=0.0330/1000=0.03. This describes how often the no-effect model gives a result at least as extreme as the example result. The estimate has simulation variability.

Compare the two simulations​

QuestionWhat varies in the simulation
How much could a sample statistic change?Draw a new sample under a population or sampling model.
How unusual is the observed treatment difference if there is no effect?Reassign labels according to the experiment's randomization scheme.

The two simulations answer different questions because they repeat different parts of the study.

Compare an effect estimate with its evidence​

An observed difference of six points gives the size of the example's measured difference. A tail proportion of 0.030.03 from the randomization model addresses how unusual that size is under the specified no-effect assumption. A larger study might find a smaller difference with an even smaller tail proportion because its randomization distribution is narrower. Report the difference in score units and the comparison procedure together so the two statements can be interpreted separately.

Keep and continue​

Keep the distinction between sampling variation and treatment assignment. When you read a statistical claim, identify which process was repeated and what assumptions the comparison uses.

Course outline

Previous: Normal Distributions