Course · Lecture notes and demonstrations

First-Year Statistics: Estimation and Hypothesis Testing

Three versions of the notes, ten demonstrations, one running example

An introductory course on estimating an unknown quantity from data and on testing claims about it: estimators and the standard error, confidence intervals, P-values, t-tests, tests for proportions, two-group comparisons, and power. The whole course follows one running question, is 37 °C really the normal body temperature?, and every main result comes with a demonstration you can run in the browser.

TrungTin Nguyen · Teaching page · Homepage

What the course offers

Three versions of the same notes. One for students of every science major (no calculus, optional R, examples from physics, chemistry, biology, earth science, psychology and health), a beginner version with worked examples and R code, and an advanced version that builds everything from the axioms of probability with full proofs. They share the running example and the demonstrations, so students in one class can read at different depths.

Demonstrations at every main result. Ten browser demonstrations, each opened from the notes at the result it illustrates and each linking back to it: predict first, then run.

Hints before solutions. Every proof and every exercise answer comes with graded hints that unlock one at a time: the key idea, then the tools, then the steps with intermediate results to aim for. Each hint unlocks a minute after you open the previous one, and the full proof or answer two minutes after the last hint. Use generative AI tools the same way: ask for the next hint, not the answer (why I teach this way).

Choose your version

Every science major

How Sure Are We? Statistics for Every Science Major

Level: Beginner

Confidence intervals, P-values, power and two-group comparisons for first-year students of any science major, with examples from physics, chemistry, biology, earth science, psychology and health: no calculus, optional R, and a demonstration at every step.

In class: Open with the question "is 37 °C normal?", run the hundred-teams demonstration before defining 95%, then vote on which sentence about the interval is right.

Beginner version

Estimation and Hypothesis Testing

Level: Beginner

Estimators, bias and standard error, confidence intervals, P-values, t-tests, tests for proportions, and Type I and II errors and power, with one running example: is 37 °C really normal?

In class: Assign Part I before the estimation lecture and use the seven-step battery exercise as a tutorial warm-up.

Advanced version

Estimation and Hypothesis Testing

Level: Advanced

The same topics built up from the axioms of probability: the normal-sample theorem, t and chi-squared pivots, the Cramér–Rao bound, uniform P-values, test–interval duality, power formulas, the Neyman–Pearson lemma and the Welch degrees of freedom, each with a full proof that opens on click.

In class: For mathematics and statistics majors: read a theorem, predict, open the proof, then check it with a demonstration.

Topic map

Where each topic is treated in each version (section numbers), and the demonstration that goes with it.

TopicEvery science majorBeginnerAdvancedDemonstration
Probability, averages and the bell curve§2, §3§1§0Averages on Trial
Estimators: bias, spread and the standard error§2§2§1Estimators on Trial
Finding estimators: moments and maximum likelihood––§2Maximum Likelihood
Confidence intervals and what 95% means§4, §5, §6§3§3Confidence Intervals
Small samples and Student's t§7§5§0.7, §3.1Why Student's t?
The logic of a test: P-values and errors§9§4§4A Hypothesis Test on Trial, Tests and Intervals
Power and sample size§9§6§5Power and Sample Size
Why these tests are optimal (Neyman-Pearson)––§6–
Proportions: one and two samples§8§7, §9§7, §9Counting Successes
Two samples: pooled, Welch and paired§10§8§8Two Samples
Reporting and reading results§11Summary––

Demonstrations

Demonstration 1

Estimators on Trial · Bias, Spread and the n − 1

Level: Beginner

Repeat a study thousands of times and compare two recipes for a guess: mean versus median, and dividing by n versus n − 1.

In class: Choose Spread at n = 5 and run 1000 studies: dividing by n lands 20% below the truth, while n − 1 sits on it.

Demonstration 2

Maximum Likelihood · Climbing the Likelihood

Level: Intermediate

See the log-likelihood of each sample, its top (the estimate) and its curvature (the standard error), then collect thousands of estimates and compare their spread with the Cramér–Rao bound.

In class: Draw one sample at a time for a proportion: the top is always at x/n. Then switch to the uniform model, where the top sits at the edge and calculus fails.

Demonstration 3

Averages on Trial · The Law of Large Numbers and the Central Limit Theorem

Level: Beginner

Average n values from a normal, uniform, skewed or yes/no population thousands of times: the averages gather at the mean, and once standardised they follow the bell curve, whatever the population's shape.

In class: Choose skewed data and step n from 1 to 5 to 30: the standardised averages turn into the bell curve, and the share beyond ±1.96 settles at 5%.

Demonstration 4

Confidence Intervals · Does the Method Catch the Truth?

Level: Beginner

A hundred research teams each build a 95% confidence interval for average body temperature; watch how many catch the true value, and when the method fails.

In class: Run 100 studies at n = 130 and see about 95 of 100 intervals catch the truth; then switch to n = 5 with the normal multiplier and watch coverage drop to about 88%, before Student's t repairs it.

Demonstration 5

Why Student's t? · Inside the Normal-Sample Theorem

Level: Intermediate

Each study records its mean and standard deviation: for normal data they are independent and give exact chi-squared and t pivots; for skewed or uniform data each promise fails.

In class: Compare normal and skewed data at n = 5: the cloud of (mean, SD) is shapeless for normal data and tilted for skewed data. At n = 30 the variance interval still covers only about 72%.

Demonstration 6

Tests and Intervals · Two Views of One Object

Level: Beginner

For fixed data, plot the t-test's P-value against every hypothesised mean: the values it does not reject form exactly the confidence interval.

In class: Drag the hypothesised mean across the body-temperature interval: the P-value crosses 0.05 exactly at the endpoints, and 37 °C is far outside.

Demonstration 7

A Hypothesis Test on Trial · P-values, Errors and Power

Level: Beginner

Run thousands of t-tests: when the null hypothesis is true, false alarms happen at rate α; when it is false, the rejection rate is the power.

In class: Start with d = 0 to see flat P-values and about 5% false alarms, then try n = 5 versus n = 50 at d = 0.5: power rises from about 24% to 97%.

Demonstration 8

Power and Sample Size · Two Bell Curves

Level: Beginner

Slide the effect size and the sample size to see α, β and power as areas under two bell curves, trace the power curve, and read off the sample size for 80% or 90% power.

In class: Start at d = 0.5 and n = 25 (power 80%), then halve d: the required sample size quadruples to 99.

Demonstration 9

Counting Successes · Exact and Approximate Methods for Proportions

Level: Intermediate

Computed exactly from binomial probabilities: why the exact test cannot use its full 5%, when the z-test oversteps it, and how the coverage of the Wald interval swings below 95%.

In class: Step n from 10 to 100 for the taste test: the exact test's size zig-zags below 5% while the z-test's crosses above it.

Demonstration 10

Two Samples · Pooled or Welch, Paired or Not?

Level: Intermediate

Thousands of two-sample studies: the pooled t-test's false-alarm rate breaks when sizes and spreads both differ, Welch's holds, and pairing multiplies power.

In class: With group sizes 30 and 10 and spread ratio 3, the pooled test rejects about 21% of true null hypotheses while Welch stays at 5%; then switch to the paired sleep study.

Using the material in class

  1. Before the lecture, students read the section of their version, with proofs and answers closed.
  2. In the lecture, pose the question, ask the class to predict, then run the demonstration at the linked preset and test the prediction.
  3. In the tutorial, work the exercises with the hints, one at a time, and open the answer only to check.
  4. For assessment, ask for an interval or a test on a new data set, reported in one sentence a scientist outside statistics would understand.

Where to go next

Next step: the undergraduate course Introduction to Mathematical Statistics (following Larsen and Marx) builds the same ideas on probability, random variables and the special distributions, then treats estimation (maximum likelihood, the Cramer-Rao bound, sufficiency, Bayesian estimation) and hypothesis testing (power, the likelihood ratio) with the book's case studies and real data.

The graduate course Probability and Statistical Inference (following Wasserman's All of Statistics) picks up every topic here with full generality and proofs. Good places to continue:

After that, Nonparametric Statistical Inference drops the assumption of a parametric model.

Errata and thanks

These notes are maintained, and readers help. If you think something is wrong, in a proof, a hint, an exercise, a figure or a demonstration, use the Report an error link under any result or exercise, or the Feedback / report an error button on every page. Reports are private. Each confirmed error is corrected in the notes and listed here, with thanks to the reader who found it (by name only if they agree).

No reader reports yet: be the first to find one.