Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter...

31
Chapter 9: Tests of hypotheses MATH 450 November 9 th , 2017 MATH 450 Chapter 9: Tests of hypotheses

Transcript of Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter...

Page 1: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Chapter 9: Tests of hypotheses

MATH 450

November 9th, 2017

MATH 450 Chapter 9: Tests of hypotheses

Page 2: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Overview

Week 1 · · · · · ·• Chapter 1: Descriptive statistics

Week 2 · · · · · ·• Chapter 6: Statistics and SamplingDistributions

Week 4 · · · · · ·• Chapter 7: Point Estimation

Week 7 · · · · · ·• Chapter 8: Confidence Intervals

Week 10 · · · · · ·• Chapter 9: Tests of Hypotheses

Week 12 · · · · · ·• Chapter 10: Two-sample inference

MATH 450 Chapter 9: Tests of hypotheses

Page 3: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Overview

9.1 Hypotheses and test procedures

test procedureserrors in hypothesis testingsignificance level

9.2 Tests about a population mean

normal population with known σlarge-sample testsa normal population with unknown σ

9.4 P-values

9.2* Type II error and sample size determination

9.3 Tests concerning a population proportion

MATH 450 Chapter 9: Tests of hypotheses

Page 4: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Type II error and sample size determination

MATH 450 Chapter 9: Tests of hypotheses

Page 5: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Hypothesis testing

In any hypothesis-testing problem, there are two contradictoryhypotheses under consideration

The null hypothesis, denoted by H0, is the claim that isinitially assumed to be true

The alternative hypothesis, denoted by Ha, is the assertionthat is contradictory to H0.

MATH 450 Chapter 9: Tests of hypotheses

Page 6: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Test procedures

A test procedure is specified by the following:

A test statistic T : a function of the sample data on which thedecision (reject H0 or do not reject H0) is to be based

A rejection region R: the set of all test statistic values forwhich H0 will be rejected

A type I error consists of rejecting the null hypothesis H0 when it istrueA type II error involves not rejecting H0 when H0 is false.

MATH 450 Chapter 9: Tests of hypotheses

Page 7: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Hypothesis testing for one parameter

1 Identify the parameter of interest

2 Determine the null value and state the null hypothesis

3 State the appropriate alternative hypothesis

4 Give the formula for the test statistic

5 State the rejection region for the selected significance level α

6 Compute statistic value from data

7 Decide whether H0 should be rejected and state thisconclusion in the problem context

MATH 450 Chapter 9: Tests of hypotheses

Page 8: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Type II error and sample size determination

A level α test is a test with P[type I error] = α

Question: given α and n, can we compute β (the probabilitiesof type II error)?

This is a very difficult question.

We have a solution for the cases when: the distribution isnormal and σ is known

MATH 450 Chapter 9: Tests of hypotheses

Page 9: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Type I error

Test of hypotheses:

H0 : µ = 75

Ha : µ < 75

n = 25, σ = 9. Rule: If x̄ ≤ 72, reject H0.

Question: What is the probability of type I error?

α = P[Type I error]

= P[H0 is rejected while it is true]

= P[X̄ ≤ 72 while µ = 75]

= P[X̄ ≤ 72 while X̄ ∼ N (75, 1.82)] = 0.0475

MATH 450 Chapter 9: Tests of hypotheses

Page 10: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Type II error

Test of hypotheses:

H0 : µ = 75

Ha : µ < 75

n = 25. New rule: If x̄ ≤ 72, reject H0.

β(70) = P[Type II error when µ = 70]

= P[H0 is not rejected while it is false because µ = 70]

= P[X̄ > 72 while µ = 70]

= P[X̄ > 72 while X̄ ∼ N (70, 1.82)] = 0.1335

MATH 450 Chapter 9: Tests of hypotheses

Page 11: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Practice problem

Problem

The drying time of a certain type of paint under specified testconditions is known to be normally distributed with standarddeviation 9 min. Assuming that we are testing

H0 : µ = 75

Ha : µ < 75

from a dataset with n = 25.

What is the rejection region of the test with significance levelα = 0.05.

What is β(70) in this case?

MATH 450 Chapter 9: Tests of hypotheses

Page 12: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

General cases

Test of hypotheses:

H0 : µ = µ0

Ha : µ < µ0

Rejection region: z ≤ −zαThis is equivalent to x̄ ≤ µ0 − zασ/

√n

Let µ′ < µ0

β(µ′) = P[Type II error when µ = µ′]

= P[H0 is not rejected while it is false because µ = µ′]

= P[X̄ > µ0 − zασ/√n while µ = µ′]

= P

[X̄ − µ′

σ/√n>µ0 − µ′

σ/√n− zα while µ = µ′

]= 1− Φ

(µ0 − µ′

σ/√n− zα

)MATH 450 Chapter 9: Tests of hypotheses

Page 13: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Remark

For µ′ < µ0:

β(µ′) = 1− Φ

(µ0 − µ′

σ/√n− zα

)If n, µ′, µ0, σ is fixed, then

β(µ′) is small

↔ Φ

(µ0 − µ′

σ/√n− zα

)is large

↔ µ0 − µ′

σ/√n− zα is large

↔ α is large

MATH 450 Chapter 9: Tests of hypotheses

Page 14: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

α− β compromise

Proposition

Suppose an experiment and a sample size are fixed and a teststatistic is chosen. Then decreasing the size of the rejection regionto obtain a smaller value of α results in a larger value of β for anyparticular parameter value consistent with Ha.

MATH 450 Chapter 9: Tests of hypotheses

Page 15: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

General formulas

MATH 450 Chapter 9: Tests of hypotheses

Page 16: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Tests concerning a population proportion

MATH 450 Chapter 9: Tests of hypotheses

Page 17: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Population and sample proportion

Let p denote the proportion of successes in a population

A random sample of n individuals is to be selected, and X isthe number of successes in the sample

Sample proportion

p̂ =X

n

MATH 450 Chapter 9: Tests of hypotheses

Page 18: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Central limit theorem for sample proportion

E (p̂) = p, σp̂ =√p(1− p)/n

When n > 30,p̂ − p√

p(1− p)/n

is approximately standard normal

MATH 450 Chapter 9: Tests of hypotheses

Page 19: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Test for population proportion with large samples

MATH 450 Chapter 9: Tests of hypotheses

Page 20: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Chapter 9: Review

MATH 450 Chapter 9: Tests of hypotheses

Page 21: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Hypothesis testing

In any hypothesis-testing problem, there are two contradictoryhypotheses under consideration

The null hypothesis, denoted by H0, is the claim that isinitially assumed to be true

The alternative hypothesis, denoted by Ha, is the assertionthat is contradictory to H0.

MATH 450 Chapter 9: Tests of hypotheses

Page 22: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Test procedures

A test procedure is specified by the following:

A test statistic T : a function of the sample data on which thedecision (reject H0 or do not reject H0) is to be based

A rejection region R: the set of all test statistic values forwhich H0 will be rejected

A type I error consists of rejecting the null hypothesis H0

when it is true

A type II error involves not rejecting H0 when H0 is false.

MATH 450 Chapter 9: Tests of hypotheses

Page 23: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Hypothesis testing for one parameter

1 Identify the parameter of interest

2 Determine the null value and state the null hypothesis

3 State the appropriate alternative hypothesis

4 Give the formula for the test statistic

5 State the rejection region for the selected significance level α

6 Compute statistic value from data

7 Decide whether H0 should be rejected and state thisconclusion in the problem context

MATH 450 Chapter 9: Tests of hypotheses

Page 24: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Normal population with known σ

Null hypothesis: µ = µ0Test statistic:

Z =X̄ − µ0σ/√n

MATH 450 Chapter 9: Tests of hypotheses

Page 25: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Large-sample tests

Null hypothesis: µ = µ0Test statistic:

Z =X̄ − µ0S/√n

[Does not need the normal assumption]

MATH 450 Chapter 9: Tests of hypotheses

Page 26: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

t-test

[Require normal assumption]

MATH 450 Chapter 9: Tests of hypotheses

Page 27: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

P-value

MATH 450 Chapter 9: Tests of hypotheses

Page 28: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Testing by P-value method

Remark: the smaller the P-value, the more evidence there is in thesample data against the null hypothesis and for the alternativehypothesis.

MATH 450 Chapter 9: Tests of hypotheses

Page 29: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

P-values for z-tests

MATH 450 Chapter 9: Tests of hypotheses

Page 30: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

P-values for z-tests

MATH 450 Chapter 9: Tests of hypotheses

Page 31: Chapter 9: Tests of hypotheses - GitHub Pagesvucdinh.github.io/Files/lecture21.pdfWeek 12 Chapter 10: Two-sample inference MATH 450 Chapter 9: Tests of hypotheses Overview 9.1Hypotheses

Interpreting P-values

A P-value:

is not the probability that H0 is true

is not the probability of rejecting H0

is the probability, calculated assuming that H0 is true, ofobtaining a test statistic value at least as contradictory to thenull hypothesis as the value that actually resulted

MATH 450 Chapter 9: Tests of hypotheses