Learn

Sampling and Inference

Contents

Inference uses a sample to make a claim about a whole population. Every method below answers one question: how far can a sample be trusted to speak for the population it came from?

What is a sample, and what makes a good one?

A population is the whole group you want to know about, and a sample is the part of it you measure. A number that describes the population is a parameter. The same number computed from the sample is a statistic, and it is your estimate of the parameter. See Populations and Samples.

There are a thousand people in the population, and you can only ask thirty. Full lesson: Populations and Samples

A good sample gives every member a known chance of being chosen. In a simple random sample every member has the same probability. In a systematic sample you take every tenth name on a list, which relies on the order of the list being fair. See Sampling Methods.

In a stratified sample, split the population into groups, then take from each group in proportion to its size. Full lesson: Sampling Methods

In an experiment the researcher assigns the treatment, for example by a coin toss. In an observational study people put themselves into groups, and those groups can differ before the treatment starts. Only random assignment supports a claim about cause. See Observational Studies and Experiments.

Assigning at random spreads every other difference evenly over the two groups. Full lesson: Observational Studies and Experiments

Capture and recapture estimates a population that cannot be listed. Tag 60 fish and release them. Later catch 80 fish and find 12 tagged. If the tagged fish have mixed fully, the same fraction of the lake is tagged: 60/N = 12/80, so N = 60 × 80 / 12 = 400. See Capture and Recapture.

Now you

Suppose the tagged fish spread right through the pond before the next catch. Is the estimate sound?

Suppose half the tags fall off before the next catch. Is the estimate sound?

Why is the mean of a sample so well behaved?

Every sample of the same size gives a different mean, so the sample mean has a distribution of its own, called the sampling distribution. See The Sampling Distribution.

Keep only the means and they pile up between 4 and 6, where the scores ran 2 to 8. Full lesson: The Sampling Distribution

Its mean is the population mean μ. Its variance is σ²/n, because n independent variances add to nσ² and dividing the total by n divides the variance by . The square root, σ/√n, is the standard error: the standard deviation of the sample mean. See Mean and Variance of X-bar and Standard Error.

With σ = 20 and n = 100, the standard error is 20 ÷ √100 = 2. Individual values scatter by about 20, and their average by about 2. To halve the standard error you need four times as many readings.

The central limit theorem supplies the shape. Whatever the population looks like, the sample mean is approximately normal once n is large enough. About thirty is usually enough, and a badly lopsided population needs more. See The Central Limit Theorem and Applying the Theorem.

Take means of samples from it and they pile up symmetrically anyway. Full lesson: The Central Limit Theorem

The same approximation works for the binomial when np and n(1 − p) are both greater than 5: a normal curve with mean np and variance np(1 − p) sits on top of the bars. The bars have width, so a count of 40 covers 39.5 to 40.5. See Approximating a Binomial and Continuity Correction.

A binomial bar for X = 7 really covers everything from 6.5 to 7.5. Full lesson: Continuity Correction

Now you

Sigma is 12 and n is 4. What is the standard error?

Sigma is 6 and n is 25. What is the standard error?

How do you estimate a population value from a sample?

The sample mean estimates the population mean, and a single number like this is a point estimate. Unbiased does not mean right; it means right on average over many samples. See Point Estimates.

Any one estimate still misses. A point estimate says nothing about by how much. Full lesson: Point Estimates

Variance needs a correction. The data sits closer to its own mean than to the population mean, so dividing by n understates the spread on average. Divide by n − 1 instead. See Unbiased Sample Variance.

A confidence interval reports a range instead. Take the estimate, then add and subtract 1.96 standard errors, because z = 1.96 leaves 2.5 percent in each tail of the normal distribution.

So report the estimate ± 1.96 standard errors — the z that leaves 2.5 percent in each tail. Full lesson: Confidence Intervals

The 95 percent describes the method: repeat it many times and 95 in 100 of the intervals contain the true mean. The one in front of you either contains it or does not. See Confidence Intervals.

The 95 percent describes the method: 95 in 100 such intervals contain the true mean. Full lesson: Confidence Intervals

Now you

The sample mean is 56 and the standard error is 1. What is the 95 percent interval?

The sample mean is 78 and the standard error is 5. What is the 95 percent interval?

How does a hypothesis test work?

Assume nothing has changed, work out how surprising your data would be if that were true, and reject the assumption if the data is surprising enough.

The null hypothesis, H₀, claims no effect. The alternative, H₁, claims an effect and needs evidence before you believe it. A test can reject the null hypothesis or fail to reject it; it can never prove the null true. See Null and Alternative Hypotheses.

Decide before seeing the data which tail counts. A one-tailed test puts the whole 5 percent in one tail. A two-tailed test splits it, 2.5 percent in each tail, so its critical value sits further out. See One-Tailed and Two-Tailed.

Testing for any change splits it: 2.5 percent in each of the two tails. Full lesson: One-Tailed and Two-Tailed

The z-test handles a mean when σ is known: z = (x̄ − μ) / (σ ÷ √n). Subtract the claimed mean, divide by the standard error, and compare z with the critical value. See The Z-Test.

A critical region fixes the boundary in advance: mark off the most extreme 5 percent, and any result landing there rejects the null. A p-value shades everything at least as extreme as the result you saw and reports that area as a probability. See Critical Regions and P-Values.

Mark off the most extreme 5 percent. That shaded tail is the critical region. Full lesson: Critical Regions
Shade everything at least as extreme as what you actually saw. Full lesson: P-Values
A p-value of 0.03 means results this extreme would happen about three times in a hundred if the null were true. It does not mean there is a 97 percent chance the effect is real, and it says nothing about how large the effect is.

For a proportion from a small sample, use the binomial directly: if a die is fair, sixes in 60 rolls follow B(60, 1/6), and the probability of 17 or more sixes is the p-value. See Testing a Proportion with the Binomial.

A type one error rejects a null hypothesis that was true, and its probability is the significance level you chose. A type two error fails to reject a false one. Demand more evidence and the first rate falls while the second rises. See Type One and Type Two Errors.

Now you

The claimed mean is 67, sigma is 10, n = 4, and the sample mean is 77. What is z?

The claimed mean is 84, sigma is 20, n = 25, and the sample mean is 80. What is z?

Which test fits which question?

QuestionTest
Is this mean different, σ known?Z-test
Is this mean different, σ estimated?One-sample t-test
Do two groups differ in mean?Two-sample t-test
Are two categorical variables related?Chi-squared for independence
Do counts match a claimed distribution?Chi-squared goodness of fit
Is the variability different?Chi-squared for a variance, or the F-test

The chi-squared tests compare observed counts with expected counts. In a two-way table, the expected count for a cell is the row total times the column total divided by the grand total. Square each gap between observed and expected, divide by the expected count, and add up every cell. The degrees of freedom are (rows − 1) × (columns − 1). See Expected Frequencies and The Chi-Squared Test for Independence.

Two in three owners keep cats. If home makes no difference, every column splits the same way. Full lesson: Expected Frequencies
Read the total against the chi-squared curve for 1 degree of freedom. Full lesson: The Chi-Squared Test for Independence

The goodness of fit test uses the same statistic against a claimed distribution: a fair die rolled 60 times expects ten of each face. See The Chi-Squared Goodness of Fit Test.

When σ must be estimated from the sample, use t instead of z. The one-sample t-test divides the gap between the sample mean and the claimed mean by s ÷ √n, with n − 1 degrees of freedom. The two-sample t-test divides the gap between two sample means by the standard error of that gap. See The One-Sample T-Test and The Two-Sample T-Test.

With the spread estimated rather than known, the curve keeps heavier tails. Full lesson: The One-Sample T-Test

Spread can be tested too. Scale a sample variance by (n − 1) / σ² and it follows a chi-squared curve with n − 1 degrees of freedom. To compare two variances, divide the larger by the smaller; that ratio is F. See Testing a Variance with Chi-Squared and Comparing Two Variances with the F-Test.

Now you

There is one sample of 8, one claimed mean, and the population spread is unknown. Which test applies?

|t| = 1.14 against a critical value of 2.2. What do you conclude?

The mistakes worth naming

Where this leads next

The binomial and normal distributions are built in the sets, counting and distributions guide. The mean and variance being tested come from the averages and spread guide. The test for a correlation coefficient is in the correlation and regression guide.

Learn this properly in the app

Math Challenge teaches each of these as an illustrated lesson with practice questions on the same skill.

Your turn

Three to try — tap what you get.

Taking every 10th name from a list is a

All else equal, a larger sample makes an estimate

A sample that overrepresents one group is

Math ChallengePractice that adapts to you, the whole lesson ladder, and your progress saved.
Start with Math Challenge

Mr. Chalk Practice this lesson in the app