hanegreefs.com/ statistics II
Home / Chapters / 05
Chapter 05 · Course ch. 13

More about tests and intervals

One-sample and paired t-tests, error types, effect size and power.

About 16 min read · Lecture material: HOC 5

Priority labels: ImportantNeutralLess important show where to spend revision time.

The one-sample t-test for a meanImportant

To test a claim μ = μ₀, standardise the sample mean with the estimated standard error. The reference model is Student's t with n − 1 degrees of freedom.

Formula
t = (ȳ − μ₀) / (s/√n), df = n − 1

Conditions are those of the t-interval: independence (randomisation, 10%) and a nearly Normal population, judged more strictly as n shrinks. State hypotheses about μ before looking at the data.

Alternativep-valueTI-84
μ ≠ μ₀2 × P(Tₙ₋₁ > |t|)2·tcdf(|t|, 1E99, df)
μ > μ₀P(Tₙ₋₁ > t)tcdf(t, 1E99, df)
μ < μ₀P(Tₙ₋₁ < t)tcdf(−1E99, t, df)

A shortcut for the whole test: STAT ▸ TESTS ▸ 2:T-Test. Beware the unexpected direction: if H_A says "greater" but the sample mean falls below μ₀ (say z = −0.8), the one-sided p-value is large, about 0.79 — no evidence in the claimed direction.

One-sided versus two-sided in practiceImportant

For z = 1.64 a two-sided test gives p ≈ 0.10, while an upper one-sided test gives p ≈ 0.05. The one-sided test puts all of α in one tail, which makes rejection easier but only in the chosen direction. Choose before the data arrive.

Intervals and tests agreeImportant

A C% interval corresponds to a two-sided test at α = 1 − C/100: 95% ↔ 0.05, 99% ↔ 0.01, 90% ↔ 0.10. If μ₀ sits inside the interval you fail to reject; outside, you reject. A one-sided test at α = 0.05 matches a 90% interval, because 5% sits in each tail of that interval.

Example: a 95% interval of [35.59, 54.93] contains 40, so H₀: μ = 40 is not rejected at α = 0.05. The interval also tells you the range of plausible values, which the test alone does not.

The paired t-testImportant

When each observation in one condition is naturally linked to one in the other (before/after on the same unit, twins, the same person rating two products), work with the differences. Pairing removes unit-to-unit variation, so it usually gains power over an unpaired analysis.

Formula
dᵢ = after − before, t = d̄ / (s_d/√n), df = n − 1
  • Hypotheses concern the mean difference μ_d, typically H₀: μ_d = 0.
  • All conditions apply to the differences: independent pairs, random sample, near-Normal differences (histogram of the dᵢ).
  • Interval: d̄ ± t*ₙ₋₁·s_d/√n.

The TI-84 has no separate paired test: put the columns in L1 and L2, define L3 = L1 − L2, and run T-Test on L3 with μ₀ = 0. In R use t.test(after, before, paired = TRUE).

The significance level αImportant

α is the cut-off you commit to before seeing the p-value. The 0.05 convention is a tradition, not a law of nature, and a p-value of 0.049 is hardly different from 0.051. Choosing α afterwards to obtain the verdict you wanted is manipulation. Statistical software often marks results with stars: “.” for p ≤ 0.10, “*” for p ≤ 0.05, “**” for p ≤ 0.01 and “***” for p ≤ 0.001.

Type I and Type II errorsImportant

H₀ trueH₀ false
Reject H₀Type I error (probability α)Correct: power = 1 − β
Fail to reject H₀CorrectType II error (probability β)

A Type I error is a false alarm (convicting an innocent person); a Type II error is a miss (letting a guilty person go). α is whatever you set. β is harder: it depends on the true parameter, so you evaluate it for a specific, meaningful alternative. For a fixed sample, lowering α raises β. The only way to reduce both is to collect more data.

Effect size and practical importanceImportant

Statistical significance (p < α) says the data clash with H₀. Practical significance asks whether the difference is big enough to matter. With a large sample a trivial gap can be significant; with a small one a large gap can be missed. Report the p-value together with the observed effect (ȳ − μ₀) and an interval.

PowerImportant

Formula
Power = P(reject H₀ | a specific H_A is true) = 1 − β
ChangeEffect on power
Larger sample sizeUp (narrower sampling distribution)
Larger true effectUp (the two distributions separate)
Larger αUp, at the price of more Type I errors
Smaller σUp
One-sided instead of two-sidedUp, in the pre-chosen direction

Studies are often planned for 80% or 90% power; the target is a scientific and financial decision, since more power means a bigger sample.

Worked example

A power calculation

Test H₀: μ = 50 against H_A: μ > 50 with σ = 8, n = 36 and α = 0.05. What is the power if the true mean is 53?

1

Standard deviation of ȳ

σ/√n = 8/6 = 1.333
2

Rejection cut-off under H₀

ȳ* = 50 + 1.645 × 1.333 = 52.19
3

Probability of exceeding it when μ = 53

z = (52.19 − 53)/1.333 = −0.61 → P(Z > −0.61) ≈ 0.727
Answer

Power ≈ 73%, so β ≈ 27%. Try n = 60 in the lab: power climbs above 90%.

PitfallsImportant

  • Cherry-picking α or the tail after seeing results.
  • Multiple testing. With k independent tests at α = 0.05 the chance of at least one false positive is 1 − 0.95ᵏ — about 64% for k = 20.
  • Absence of evidence is not evidence of absence. A non-significant result may just mean low power.
  • Treating 0.05 as a magic border instead of reading the p-value and interval together.

R toolboxNeutral

t.test(x, mu = 40, alternative = "two.sided", conf.level = 0.95) t.test(after, before, paired = TRUE) power.t.test(n = 36, delta = 3, sd = 8, sig.level = 0.05, type = "one.sample", alternative = "one.sided")

Key takeaways

  • One-sample and paired t-tests are the same machine: t = (estimate − null) / SE with n − 1 df.
  • Two-sided tests match C% intervals; one-sided tests match 90%-type intervals.
  • α = P(Type I); power = 1 − β grows with n, effect size and α; only more data cuts both errors.
Question
Tap or press space to reveal
Answer
Did you know it?

Multiple choice

Ch 05 · Question 1

In a paired t-test, the analysed variable is…

Why: One-sample t on differences.
Ch 05 · Question 2

Power is…

Why: Probability to reject a false H₀.
Ch 05 · Question 3

Lowering α with n fixed will…

Why: The two error types trade off.
Ch 05 · Question 4

Which change does NOT increase power?

Why: More noise reduces power.
Ch 05 · Question 5

Testing 20 independent true nulls at α = 0.05, P(at least one false positive) ≈ …

Why: 1 − 0.95²⁰ ≈ 0.64.
Ch 05 · Question 6

A non-significant result with low power suggests…

Why: Low power makes failures to reject uninformative.
Ch 05 · Question 7

A two-sided 95% interval for μ is [38.2, 41.9]. Testing H₀: μ = 40 at α = 0.05…

Why: 40 lies inside the interval.
Ch 05 · Question 8

df for a paired t-test with 12 pairs?

Why: n − 1 where n counts pairs.

Exam-style questions

Exam-style · Ch 05

Explain Type I and Type II errors for the test H₀: new packaging does not change sales. Which is worse and how can both be reduced?

Show outline of a full answer
  1. Type I: conclude sales changed when they did not (cost: roll out useless packaging).
  2. Type II: miss a real improvement.
  3. Which is worse depends on costs; α controls Type I.
  4. Both fall when n rises; power = 1 − β.
Exam-style · Ch 05

Eight stores measure weekly sales before and after a layout change (differences, after − before: 3, 5, −1, 4, 2, 6, 0, 3 in k€). Test at 5% whether sales rose.

Show outline of a full answer
  1. Paired t on differences; conditions: random stores, differences nearly Normal.
  2. d̄ = 2.75, s_d ≈ 2.38, SE ≈ 0.84, t ≈ 3.27 on 7 df.
  3. One-sided p ≈ 0.007 → reject H₀.
  4. Conclusion in context + 95% interval for the mean increase.

One-sample and paired t-testInteractive

Summary statistics in; t, df, p-value and interval out. Works for paired data with the differences' summary.

Power and error ratesInteractive

Move n, the true mean, σ and α and watch α, β and power change on the two curves.