+ All Categories
Home > Documents > Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in...

Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in...

Date post: 16-Apr-2020
Category:
Upload: others
View: 14 times
Download: 0 times
Share this document with a friend
36
Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis testing process I Type I and Type II errors, power I Test statistic, level of significance and rejection/acceptance regions in upper-, lower- and two-tail tests I Test of hypothesis: procedure I p-value I Two-tail tests and confidence intervals I Examples with various parameters I Power and sample size calculations
Transcript
Page 1: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Chapter 2. Hypothesis testing in one population

Contents

I Introduction, the null and alternative hypotheses

I Hypothesis testing process

I Type I and Type II errors, power

I Test statistic, level of significance and rejection/acceptance regionsin upper-, lower- and two-tail tests

I Test of hypothesis: procedure

I p-value

I Two-tail tests and confidence intervals

I Examples with various parameters

I Power and sample size calculations

Page 2: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Chapter 2. Hypothesis testing in one population

Learning goalsAt the end of this chapter you should be able to:

I Perform a test of hypothesis in a one-population setting

I Formulate the null and alternative hypotheses

I Understand Type I and Type II errors, define the significance level,define the power

I Choose a suitable test statistic and identify the correspondingrejection region in upper-, lower- and two-tail tests

I Use the p-value to perform a test

I Know the connection between a two-tail test and a confidenceinterval

I Calculate the power of a test and identify a sample size needed toachieve a desired power

Page 3: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Chapter 2. Hypothesis testing in one population

ReferencesI Newbold, P. ”Statistics for Business and Economics”

I Chapter 9 (9.1-9.5)

I Ross, S. ”Introduction to Statistics”I Chapter 9

Page 4: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Test of hypothesis: introduction

A test of hypothesis is a procedure that:

I is based on a data sample

I and allows us to make a decision

I about a validity of some conjecture or hypothesis about thepopulation X , typically the value of a population parameter θ (θ canbe any of the parameters we covered so far: µ, p, σ2, etc)

This hypothesis, called a null hypothesis (H0):

I Can be thought of as a hypothesis being supported (before the testis carried out)

I Will be believed unless sufficient contrary sample evidence isproduced

I When sample information is collected, this hypothesis is put injeopardy, or tested

Page 5: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

The null hypothesis: examples

1. A manufacturer who produces boxes of cereal claims that, on average,their contents weigh at least 20 ounces. To check this claim, the contentsof a random sample of boxes are weighed and inference is made.Population: X = ’weight of a box of cereal (in oz)’

Null hypothesis, H0 : µ ≥

µ0z}|{20' SRS

Does sample data produce evidence against H0?

2. A company receiving a large shipment of parts accepts their delivery onlyif no more than 50% of the parts are defective. The decision is based on acheck of a random sample of these parts.Population: X = 1 if a part is defective and 0 otherwiseX ∼ Bernoulli(p), p = proportion of defective parts in the entire shipment

Null hypothesis, H0 : p ≤

p0z}|{0.5' SRS

Does sample data produce evidence against H0?

Page 6: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Null hypothesis, H0

I States the assumption to be tested

I We begin with the assumption that the null hypothesis is true (similar tothe notion of innocent until proven guilty)

I Refers to the status quo

I Always contains a ’=’, ’≤’ or ’≥’ sign (closed set)

I May or may not be rejected

I Simple hypothesis (specifies a single value):

H0 : µ =

µ0z}|{5 , H0 : p =

p0z}|{0.6 , H0 : σ2 =

σ20z}|{

9 In general: H0 : θ = θ0

Parameter space under this null: Θ0 = {θ0}I Composite hypothesis (specifies a range of values):

H0 : µ ≤

µ0z}|{5 , H0 : p ≥

p0z}|{0.6 In general: H0 : θ ≤ θ0 or H0 : θ ≥ θ0

Parameter space under this null: Θ0 = (−∞, θ0] or Θ0 = [θ0,∞)

Page 7: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Alternative hypothesis, H1If the null hypothesis is not true, then some alternative must be true, and incarrying out a hypothesis test, the investigator formulates an alternativehypothesis against which the null hypothesis is tested.The alternative hypothesis H1:

I Is the opposite of the null hypothesis

I Challenges the status quo

I Never contains ’=’, ’≤’ or ’≥’ sign

I May or may not be supported

I Is generally the hypothesis that the researcher is trying to support

I One-sided hypothesis:

(upper-tail) H1 : µ > 5 (lower-tail) H0 : p < 0.6

In general: H1 : θ > θ0 or H1 : θ < θ0

Parameter space under this alternative: Θ1 = (θ0,∞) or Θ1 = (−∞, θ0)

I Two-sided hypothesis (two-tail):

H1 : σ2 6= 9 In general: H1 : θ 6= θ0

Parameter space under this alternative: Θ1 = (−∞, θ0) ∪ (θ0,∞)

Page 8: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

The alternative hypothesis: examples

1. A manufacturer who produces boxes of cereal claims that, on average,their contents weigh at least 20 ounces. To check this claim, the contentsof a random sample of boxes are weighed and inference is made.Population: X = ’weight of a box of cereal (in oz)’Null hypothesis, H0 : µ ≥ 20 versus

Alternative hypothesis, H1 : µ < 20' SRS

Does sample data produce evidence against H0 in favour of H1?

2. A company receiving a large shipment of parts accepts their delivery onlyif no more than 50% of the parts are defective. The decision is based on acheck of a random sample of these parts.Population: X = 1 if a part is defective and 0 otherwiseX ∼ Bernoulli(p), p = proportion of defective parts in the entire shipmentNull hypothesis, H0 : p ≤ 0.5 versus

Alternative hypothesis, H1 : p > 0.5' SRS

Does sample data produce evidence against H0 in favour of H1?

Page 9: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Hypothesis testing process

xyyxxxxyyPopulation:

X = ’height of a UC3M student (in m)’Claim: On average, students are shorter

than 1.6 ⇒ Hypotheses:

H0 : µ ≤ 1.6 versus H1 : µ > 1.6

Is it likely to observe asample mean x̄ = 1.65if the population mean isµ ≤ 1.6?

' SRS yyxxSample: Suppose the samplemean height is 1.65 m, x̄ = 1.65

If not likely, reject the nullhypothesis in favour of thealternative.

Page 10: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Hypothesis testing process

I Having specified the null and alternative hypotheses and collectedthe sample information, a decision concerning the null hypothesis(reject or fail to reject H0) must be made.

I The decision rule is based on the value of a “distance” between thesample data we have collected and those values that would have anigh probabiilty under the null hypothesis.

I This distance is calculated as the value of a so-called test statistic(closely related to the pivotal quantities we talked about in Chapter1). We will discuss specific cases later on.

I However, whatever decision is made, there is some chance ofreaching an erroneous conclusion about the population parameter,because all that we have available is a sample and thus we cannotknow for sure if the null hypothesis is true or not.

I There are two possible states of nature and thus two errors can becommitted: Type I and Type II errors.

Page 11: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Type I and Type II errors, power

I Type I Error: to reject a true null hypothesis. A Type I error is considereda serious type of error. The probability of a Type I Error is equal to α andis called the significance level.

α = P(reject the null|H0 is true)

I Type II Error: to fail to reject a false null hypothesis. The probability of aType II Error is β.

β = P(fail to reject the null|H1 is true)

I power: is the probability of rejecting a null hypothesis (that is false).

power = 1− β = P(reject the null|H1 is true)

Actual situationDecision H0 true H0 false

Do not No error Type II ErrorReject H0 (1− α) (β)

Reject Type I error No ErrorH0 (α) (1− β = power)

Page 12: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Type I and Type II errors, power

I Type I and Type II errors can not happen at the same timeI Type I error can only occur if H0 is true

I Type II error can only occur if H0 is false

I If the Type I error probability (α) ⇑, then the Type II errorprobability β ⇓

I All else being equal:I β ⇑ when the difference between the hypothesized parameter value

and its true value ⇓I β ⇑ when α ⇓I β ⇑ when σ ⇑I β ⇑ when n ⇓I The power of the test increases as the sample size increasesI For θ ∈ Θ1

power(θ) = 1− βI For θ ∈ Θ0

power(θ) ≤ α

Page 13: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Test statistic, level of significance and rejection region

Test statistic, T

I Allows us to decide if the sample data is “likely” or “unlikely” tooccur, assuming the null hypothesis is true.

I It is the pivotal quantity from Chapter 1 calculated under the nullhypothesis.

I The decision in the test of hypothesis is based on the observed valueof the test statistic, t.

I The idea is that, if the data provide an evidence against the nullhypothesis, the observed test statistic should be “extreme”, that is,very unusual. It should be “typical” otherwise.

I In distinguishing between “extreme” and “typical” we use:I the sampling distribution of the test statisticI the significance level α to define so-called rejection (or critical)

region and the acceptance region.

Page 14: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Test statistic, level of significance and rejection regionRejection region (RR) and acceptance region (AR) in size α tests:

Upper-tail test H1 : θ > θ0 RRα = {t : t > Tα} ARα = {t : t ≤ Tα} ●

CRITICAL VALUE

AR RR

α

Lower-tail test H1 : θ < θ0 RRα = {t : t < T1−α} ARα = {t : t ≥ T1−α} ●

CRITICAL VALUE

ARRR

α

Two-tail test H1 : θ 6= θ0 RRα = {t : t < T1−α/2 or t > Tα/2}ARα = {t : T1−α/2 ≤ t ≤ Tα/2}

● ●CRITICAL VALUE

CRITICAL VALUE

ARRR RR

α 2 α 2

Page 15: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Test statistics

Let X n be a s.r.s. from a population X with mean µ and variance σ2, α a significance

level, zα the upper α quantile of N(0,1), µ0 the population mean under H0, etc.

Parameter Assumptions Test statistic RRα in two-tail test

Normal dataKnown variance

X̄−µ0σ/√

n∼ N(0, 1)

8>>>>><>>>>>:z :

zz }| {x̄ − µ0

σ/√

n< z1−α/2 or

x̄−µ0σ/√

n> zα/2

9>>>>>=>>>>>;Mean Non-normal data

Large sample

X̄−µ0σ̂/√

n∼ap. N(0, 1)

z :

x̄−µ0σ̂/√

n< z1−α/2 or

x̄−µ0σ̂/√

n> zα/2

ffBernoulli dataLarge sample

p̂−p0pp0(1−p0)/n

∼ap. N(0, 1)

z :

p̂−p0pp0(1−p0)/n

< z1−α/2 orp̂−p0p

p0(1−p0)/n> zα/2

ff

Normal dataUnknown variance

X̄−µ0s/√

n∼ tn−1

8>>>>><>>>>>:t :

tz }| {x̄ − µ0

s/√

n< tn−1;1−α/2 or

x̄−µ0s/√

n> tn−1;α/2

9>>>>>=>>>>>;

Variance Normal data(n−1)s2

σ20

∼ χ2n−1

8>>>>>>>><>>>>>>>>:χ2 :

χ2z }| {(n − 1)s2

σ20

< χ2n−1;1−α/2

or(n−1)s2

σ20

> χ2n−1;α/2

9>>>>>>>>=>>>>>>>>;St. dev. Normal data

(n−1)s2

σ20

∼ χ2n−1

(χ2 :

(n−1)s2

σ20

< χ2n−1;1−α/2

or(n−1)s2

σ20

> χ2n−1;α/2

)

Question: How would you define RRα in upper- and lower-tail tests?

Page 16: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Test of hypothesis: procedure

1. State the null and alternative hypotheses.

2. Calculate the observed value of the test statistic (see the formulasheet).

3. For a given significance level α define the rejection region (RRα).I Reject H0, the null hypothesis, if the test statistic is in RRα and fail

to reject H0 otherwise.

4. Write down the conclusions in a sentence.

Page 17: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Upper-tail test for the mean, variance known: example

Example: 9.1 (Newbold) When a process producing ball bearings is operatingcorrectly, the weights of the ball bearings have a normal distribution with mean5 ounces and standard deviation 0.1 ounces. The process has been adjustedand the plant manager suspects that this has raised the mean weight of the ballbearings, while leaving the standard deviation unchanged. A random sample ofsixteen bearings is selected and their mean weight is found to be 5.038 ounces.Is the manager right? Carry out a suitable test at a 5% level of significance.

Population:X = ”weight of a ball bearing (in oz)”X ∼ N(µ, σ2 = 0.12)

' SRS: n = 16

Sample: x̄ = 5.038

Objective: test

H0 : µ =

µ0z}|{5 against H1 : µ > 5

(Upper-tail test)

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

n∼ N(0, 1)

Observed test statistic:

σ = 0.1 µ0 = 5

n = 16 x̄ = 5.038

z =x̄ − µ0

σ/√

n

=5.038− 5

0.1/√

16= 1.52

Page 18: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Upper-tail test for the mean, variance known: example

Example: 9.1 (cont.)Rejection (or critical) region:

RR0.05 = {z : z > z0.05}= {z : z > 1.645}

Since z = 1.52 /∈ RR0.05 we failto reject H0 at a 5% significancelevel.

N(0,1) density ●

z=1.52

zα = 1.645AR RR

Conclusion: The sample data did not provide sufficient evidence to rejectthe claim that the average weight of the bearings is 5oz.

Page 19: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Definition of p-value

I It is the probability of obtaining a test statistic at least as extreme(≤ or ≥) as the observed one (given H0 is true)

I Also called the observed level of significance

I It is the smallest value of α for which H0 can be rejected

I Can be used in step 3) of the testing procedure with the followingrule:

I If p-value < α, reject H0

I If p-value ≥ α, fail to reject H0

I Roughly:I “small” p-value - evidence against H0

I “large” p-value - evidence in favour of H0

Page 20: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

p-valuep-value when t is the observed value of the test statistic T :

Upper-tail test H1 : θ > θ0 p-value = P(T ≥ t)

test stat

p−value =area

Lower-tail test H1 : θ < θ0 p-value = P(T ≤ t)

test stat

p−value =area

Two-tail test H1 : θ 6= θ0 p-value = P(T ≤ −|t|) + P(T ≥ |t|)

|test stat|

−|test stat|

p−value =left+right

areas

Page 21: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

p-value: exampleExample: 9.1 (cont.)

Population:X = ”weight of a ball bearing (in oz)”X ∼ N(µ, σ2 = 0.12)

' SRS: n = 16

Sample: x̄ = 5.038

Objective: test

H0 : µ =

µ0z}|{5 against H1 : µ > 5

(Upper-tail test)

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

n∼ N(0, 1)

Observed test statistic: z = 1.52

N(0,1) density

p-value = P(Z ≥ z) = P(Z ≥ 1.52)

= 0.0643 where Z ∼ N(0, 1)

Since it holds thatp-value = 0.0643 ≥ α = 0.05we fail to reject H0 (but would rejectat any α greater than 0.0643, e.g.,α = 0.1).

z=1.52

p−value =area

Page 22: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

The p-value and the probability of the null hypothesis 1

I The p-value:I is not the probability of H0 nor the Type I error α;I but it can be used as a test statistic to be compared with α (i.e.

reject H0 if p-value < α).

I We are interested in answering: How probable is the null given thedata?

I Remember that we defined the p-value as the probability of the data(or values even more extreme) given the null.

I We cannot answer exactly.I But under fairly general conditions and assuming that if we had no

observations Pr(H0) = Pr(H1) = 1/2, then for p-values, p, such thatp < 0.36:

Pr(H0|Observed Data) ≥ −ep ln(p)

1− ep ln(p).

1Selke, Bayarri and Berger, The American Statistician, 2001

Page 23: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

The p-value and the probability of the null hypothesis

This table helps to calibrate a desired p-value as a function of theprobability of the null hypothesis:

p-value Pr(H0|Observed Data) ≥0.1 0.39

0.05 0.290.01 0.11

0.001 0.020.00860 0.10.00341 0.050.00004 0.01≤ 0.00001 0.001

I For a p-value equal to 0.05 the null has a probability of at least 29%of being true

I While if we want the probability of the null being true to be at most5%, the p-value should be no larger than 0.0034.

Page 24: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Confidence intervals and two-tail tests: duality

A two-tail test of hypothesis at a significance level α can be carried outusing a (two-tail) 100(1− α)% confidence interval in the following way:

1. State the null and two-sided alternative

H0 : θ = θ0 against H1 : θ 6= θ0

2. Find a 100(1− α)% confidence interval for θ

3. If θ0 doesn’t belong to this interval, reject the null.If θ0 belongs to this interval, fail to reject the null.

4. Write down the conclusions in a sentence.

Page 25: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Two-tail test for the mean, variance known: example

Example: 9.2 (Newbold) A drill is used to make holes in sheet metal.When the drill is functioning properly, the diameters of these holes have anormal distribution with mean 2 in and a standard deviation of 0.06 in.To check that the drill is functioning properly, the diameters of a randomsample of nine holes are measured. Their mean diameter was 1.95 in.Perform a two-tailed test at a 5% significance level using a CI-approach.

Population:X = ”diameter of a hole (in inches)”X ∼ N(µ, σ2 = 0.062)

' SRS: n = 9

Sample: x̄ = 1.95

Objective: test

H0 : µ =

µ0︷︸︸︷2 against H1 : µ 6= 2

(Two-tail test)

100(1− α)% = 95% confidenceinterval for µ:

CI0.95(µ) =

(x̄ ∓ 1.96

σ√n

)=

(1.95∓ 1.96

0.06√9

)= (1.9108, 1.9892)

Since µ0 = 2 /∈ CI0.95(µ) wereject H0 at a 5% significancelevel.

Page 26: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Two-tail test for the proportion: exampleExample: 9.6 (Newbold) In a random sample of 199 audit partners inU.S. accounting firms, 104 partners indicated some measure ofagreement with the statement: “Cash flow from operations is a validmeasure of profitability”. Test at the 10% level against a two-sidedalternative the null hypothesis that one-half of the members of thispopulation would agree with the preceding statement.

Population:X = 1 if a member agrees with thestatement and 0 otherwiseX ∼ Bernoulli(p)

' SRS: n = 199 large n

Sample: p̂ = 104199 = 0.523

Objective: test

H0 : p =

p0︷︸︸︷0.5 against H1 : p 6= 0.5

(Two-tail test)

Test statistic:Z = p̂−p0√

p0(1−p0)/n∼approx. N(0, 1)

Observed test statistic:

p0 = 0.5

n = 199 p̂ = 0.523

z =p̂ − p0√

p0(1− p0)/n

=0.523− 0.5√

0.5(1− 0.5)/199

= 0.65

Page 27: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Two-tail test for the proportion: example

Example: 9.6 (cont.)Rejection (or critical) region:

RR0.10 = {z : z > z0.05} ∪{z : z < −z0.05}

= {z : z > 1.645} ∪{z : z < −1.645}

Since z = 0.65 /∈ RR0.10 we failto reject H0 at a 10% significancelevel.

N(0,1) density ● ●

z=0.65

zα2

= 1.645− zα2

= − 1.645AR RRRR

Conclusion: The sample data does not contain sufficiently strongevidence against the hypothesis that one-half of all audit partners agreethat cash flow from operations is a valid measure of profitability.

Page 28: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Lower-tail test for the mean, variance unknown: exampleExample: 9.4 (Newbold, modified) A retail chain knows that, on average, salesin its stores are 20% higher in December than in November. For a randomsample of six stores the percentages of sales increases were found to be: 19.2,18.4, 19.8, 20.2, 20.4, 19.0. Assuming a normal population, test at a 10%significance level the null hypothesis (use a p-value approach) that the truemean percentage sales increase is at least 20, against a one-sided alternative.

Population:X = “stores increase in sales from Nov toDec (in %s)”

X ∼ N(µ, σ2) σ2 unknown

' SRS: n = 6 small n

Sample: x̄ = 1176

= 19.5

s2 = 2284.44−6(19.5)2

6−1= 0.588

Objective: test

H0 : µ ≥

µ0z}|{20 against H1 : µ < 20

(Lower-tail test)

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

n∼ tn−1

Observed test statistic:

µ0 = 20 n = 6

x̄ = 1.95 s =√

0.588 = 0.767

t =x̄ − µ0

s/√

n

=19.5− 20

0.767/√

6= −1.597

Page 29: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Lower-tail test for the mean, variance unknown: example

Example: 9.4 (cont.)

p-value = P(T ≤ −1.597)

∈ (0.05, 0.1) because

−t5;0.05︷ ︸︸ ︷−2.015 < −1.597 <

−t5;0.10︷ ︸︸ ︷−1.476

Hence, given thatp-value < α = 0.1 we reject thenull hypothesis at this level.

tn−1 density | |

t=−1.597

p−value =area

−2.015 −1.476

Conclusion: The sample data gave enough evidence to reject the claimthat the average increase in sales was at least 20%.p-value interpretation: if the null hypothesis were true, the probability ofobtaining such sample data would be at most 10%, which is quiteunlikely, so we reject the null hypothesis.

Page 30: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Lower-tail test for the mean, variance unknown: example

Example: 9.4 (cont.) in Excel: Go to menu: Data, submenu: DataAnalysis, choose function: two-sample t-test with unequal variances.Column A (data), Column B (n repetitions of µ0 = 20), in yellow(observed t stat, p-value and tn−1;α).

Page 31: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Upper-tail test for the variance: exampleExample: 9.5 (Newbold) In order to meet the standards in consignments of achemical product, it is important that the variance of their percentage impuritylevels does not exceed 4. A random sample of twenty consignments had asample quasi-variance of 5.62 for impurity level percentages.

a) Perform a suitable test of hypothesis (α = 0.1).

b) Find the power of the test. What is the power at σ21 = 7?

c) What sample size would guarantee a power of 0.9 at σ21 = 7?

Population:X = “impurity level of a consignment of achemical (in %s)”X ∼ N(µ, σ2)

' SRS: n = 20

Sample: s2 = 5.62

Objective: test

H0 : σ2 ≤

σ20z}|{

4 against H1 : σ2 > 4

(Upper-tail test)

Test statistic: χ2 = (n−1)s2

σ20∼ χ2

n−1

Observed test statistic:

σ20 = 4 n = 20

s2 = 5.62

χ2 =(n − 1)s2

σ20

=(20− 1)5.62

4= 26.695

Page 32: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Upper-tail test for the variance: example

Example: 9.5 a) (cont.)

p-value = P(χ2 ≥ 26.695)

∈ (0.1, 0.25) because

χ219;0.25︷︸︸︷22.7 < 26.695 <

χ219;0.1︷︸︸︷27.2

Hence, given that p-value exceedsα = 0.1, we cannot reject the nullhypothesis at this level.

χ2n−1 density

χ2 =

26.695

p−value =area

● ●22.7 27.2

Conclusion: The sample data did not provide enough evidence to rejectthe claim that the variance of the percentage impurity levels inconsignments of this chemical is at most 4.

Page 33: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Upper-tail test for the variance: power

Example: 9.5 b) Recall that: power = P(reject H0|H1 is true)

When do we reject H0?

RR0.1 =

(n − 1)s2

σ20

> χ2n−1;0.1

ff

=

8>><>>:(n − 1)s2 >

27.2 · 4 = 108.8z }| {χ2

n−1;0.1 · σ20

9>>=>>;Hence the power is:

power(σ21) = P

“reject H0|σ2 = σ2

1

”= P

“(n − 1)s2 > 108.8|σ2 = σ2

1

”= P

„(n − 1)s2

σ21

>108.8

σ21

«= P

„χ2 >

108.8

σ21

«= 1− Fχ2

„108.8

σ21

«

power(σ2) versus σ2

0 2 4 6 8 100.0

0.2

0.4

0.6

0.8

1.0

power(σ2) =1 − β(σ2)

σ02 = 4

α

Θ0 Θ1 σ2

(Fχ2 is the cdf of χ2n−1) Hence, power(7) = P

`χ2 > 108.8

7

´= 0.6874.

Page 34: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Upper-tail test for the variance: sample size calculations

Example: 9.5 c)From our previous calculations, we know that

potencia(σ21) = P

((n−1)s2

σ21

> χ2n−1;0.1

σ20

σ21

), (n−1)s2

σ21∼ χ2

n−1

Our objective is to find the smallest n such that:

power(7) = P

(n − 1)s2

σ21

> χ2n−1;0.1

0.571︷︸︸︷4

7

≥ 0.9

The last equation implies that we are dealing with a χ2n−1 distribution,

whose upper 0.9-quantile satisfies χ2n−1;0.9 ≥ 0.571χ2

n−1;0.1.

chi-square table χ243;0.9/χ

243;0.1 = 0.573 > 0.571 ⇒ n − 1 = 43

Thus, if we collect 44 observations we should be able to detect thealternative value σ2

1 = 7 with at least 90% chance.

Page 35: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Another power example: lower-tail test for the mean,normal population, known σ2

I H0 : µ ≥ µ0 versus H1 : µ < µ0 at α = 0.05

I Say that µ0 = 5, n = 16, σ = 0.1

I We reject H0 if x̄−µ0

σ/√

n< −zα = −1.645 that is when x̄ ≥ 4.96, hence

power(µ1) = P(Z < 4.96−µ1

0.1/√

16

)

4.85 4.95 5.050.0

0.2

0.4

0.6

0.8

1.0

µ0 = 5

α

Θ0Θ1 µ

power(µ) =1 − β(µ)

4.85 4.95 5.050.0

0.2

0.4

0.6

0.8

1.0

n=16n=9n=4

Page 36: Statistics II Chapter 2: Hypothesis testing in one population · Chapter 2. Hypothesis testing in one population Contents I Introduction, the null and alternative hypotheses I Hypothesis

Another power example: lower-tail test for the mean,normal population, known σ2

Note that the power = 1− P(Type II error) function has the followingfeatures (everything else being equal):

I The farther the true mean µ1 from the hypothesized µ0, the greaterthe power

I The smaller the α, the smaller the power, that is, reducing theprobability of Type I error will increase the probability of Type II error

I The larger the population variance, the lower the power (we are lesslikely to detect small departures from µ0, when there is greatervariability in the population)

I The larger the sample size, the greater the power of the test (themore info from the population, the greater the chance of detectingany departures from the null hypothesis).


Recommended