0% found this document useful (0 votes)
15 views17 pages

Sta255 Week 12-2 Pre

The document discusses hypothesis testing in statistical theory, focusing on Type I and II errors, p-values, and various test statistics for normal distributions. It includes examples of hypothesis tests for both known and unknown variances, as well as two-sample tests and paired sample tests. The content is structured to guide students through understanding the concepts and applications of hypothesis testing in statistics.

Uploaded by

배민규
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views17 pages

Sta255 Week 12-2 Pre

The document discusses hypothesis testing in statistical theory, focusing on Type I and II errors, p-values, and various test statistics for normal distributions. It includes examples of hypothesis tests for both known and unknown variances, as well as two-sample tests and paired sample tests. The content is structured to guide students through understanding the concepts and applications of hypothesis testing in statistics.

Uploaded by

배민규
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

STA255H1S: Statistical Theory

Week 12-2: Hypothesis test

Yaoming Zhen

Department of Statistical Sciences


University of Toronto

March 27, 2025

1 / 17
Roadmap

1. Hypothesis test

2 / 17
Type I and II Errors

Example
Suppose the speed limit is 120 km/hr and a device has
recorded the speed of 3 cars. We assume X ∼ N(µ, 4) and we
want to test H0 : µ = 120 vs H1 : µ > 120 with test statistic
T = X1 +X32 +X3 = X̄ .
(a). What values of t will reject H0 for α = 0.05? (z0.05 = 1.64)?

3 / 17
Type I and II Errors

(b). If the police decide to fine drivers going over 121 km/hr,
what is the probability of a tyle I error?

4 / 17
Type I and II Errors

(c). If a car passes at a true speed of 123 km/hr, what is the


probability of a type II error under critical region in (a)?

5 / 17
p-values

The type I error α is also called the significant level

If α is small (usually below 0.05), the decision to reject H0


is convincing, otherwise it is not very convincing.

The p-value is defined as P(the test statistics is at least as


extreme as what we got |H0 )

If p < α, then the experimenter will reject H0 in favor of HA .

6 / 17
p-value for Normal Hypothesis Test

We assume X1 , X2 , ..., Xn ∼ N(µ, σ 2 ), where µ is unknown


and σ is known.

Null hypothesis: µ = µ0 for some specific value µ0

X̄ −µ
Test statistic: Z = σ/ n
√0

Null distribution: Z ∼ N(0, 1)

One-sided p-value (right side): p = P(Z > z|H0 )

One-sided p-value (left side): p = P(Z < z|H0 )

Two-sided p-value: p = P(|Z | > |z|)

7 / 17
Normal Hypothesis Test

Example
Suppose that we have data that follows a normal distribution of
unknown mean µ and known variance σ 2 = 4. Let the null
hypothesis be H0 : µ = 0. Let the alternative hypothesis be H1 :
µ > 0. Suppose we collect the following data: 1, 2, 3, 6, -1. At
significance level α = 0.05, should we reject H0 ?

8 / 17
Normal Hypothesis Test with unknown σ 2

Assume X1 , X2 , ..., Xn ∼ N(µ, σ 2 ) with unknown µ and σ 2

Null hypothesis: µ = µ0 for some specific value µ0

X̄ −µ
Test statistic: T = S/ n
√0

Null distribution: T ∼ t(n − 1)

One-sided p-value (right side): p = P(T > t|H0 )

One-sided p-value (left side): p = P(T < t|H0 )

Two-sided p-value: p = P(|T | > |t|)

9 / 17
Normal Hypothesis Test

Example con’t
Suppose that we have data that follows a normal distribution of
unknown mean µ and unknown variance σ 2 . Let the null
hypothesis H0 be that µ = 0. Let the alternative hypothesis HA
be that µ > 0. Suppose we collect the following data: 1, 2, 3, 6,
-1. At significance level α = 0.05, should we reject H0 ?

10 / 17
Tests for Large Samples

For large sample sizes the distribution of the studentized mean


can be approximated by a standard normal distribution. We still
calculate
x̄ − µ0
t= √
s/ n

But the test can be approximated by P(Z ≤ t) where


Z ∼ N(0, 1)

11 / 17
Two-Sample Equal Variances

Use: Test if the population means from two populations dif-


fer by a hypothesized amount.
Data: X1 , X2 , ..., Xn and Y1 , Y2 , ..., Ym .
Assumptions: Both groups of data are independent normal
samples:

Xi ∼ N(µx , σ 2 )
Yj ∼ N(µy , σ 2 )

where both µx and µy are unknown and possibly different. The


variance σ 2 is unknown, but the same for both groups.

12 / 17
Two-Sample Equal Variances

H0 : For a specified µ0 : µx − µy = µ0

HA : For a specified µ0 : µx − µy ̸= µ0

Test-statistic:
X̄ − Ȳ − µ0
T = q
sp n1 + m1

where sP2 is the pooled sample variance.

(n − 1)sx2 + (m − 1)sy2
sp2 =
n+m−2

13 / 17
Two-Sample Equal Variances

Example
Real data from 1408 women admitted to a maternity hospital for
(i) medical reasons or through (ii) unbooked emergency
admission. The duration of pregnancy is measured in complete
weeks from the beginning of the last menstrual period. Medical:
775 obs. with x̄ = 39.08 and sx2 = 7.77 Emergency: 633 obs.
with ȳ = 39.60 and sy2 = 4.95. Set up and run a two-sample
t-test to investigate whether the duration differs for the two
groups.

14 / 17
Two-Sample Equal Variances

15 / 17
Paired Two-Sample T-Test

Use: Test if the average difference between paired values


in a population equals a hypothesized value.

Data: X1 , X2 , ..., Xn and Y1 , Y2 , ..., Yn must have the same


length.

Assumptions: The differences Wi = Xi − Yi between the


paired samples are independent follow normal distribution
N(µ, σ 2 ), where µ and σ are unknown.

NOTE: This is just a one-sample t-test using Wi .

16 / 17
Paired Two-Sample T-Test

H0 : µ = µ0 .

HA : µ ̸= µ0 .

W̄ −µ
Test statistic: T = √0
S/ n

S 2 is the sample variance:


n
1 X
2
S = (Wi − W̄ )2
n−1
i=1

Null distribution: T ∼ t(n − 1).

17 / 17

You might also like