hypothesis testing an introduction

58
Lecture 7 Lecture 7 Hypothesis Testing: An Hypothesis Testing: An Introduction Introduction

Upload: geetika-gulyani

Post on 22-Nov-2014

2.041 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Hypothesis testing an introduction

Lecture 7Lecture 7Hypothesis Testing: An Hypothesis Testing: An

IntroductionIntroduction

Page 2: Hypothesis testing an introduction

TopicsTopics

Steps in a hypothesis test.Steps in a hypothesis test.Large sample tests for Large sample tests for µµ: two: two--tail.tail.Large sample tests for Large sample tests for µµ: one: one--tail.tail.Type I and Type II errors.Type I and Type II errors.

Page 3: Hypothesis testing an introduction

Section 7.4Section 7.4

Steps in a Hypothesis TestSteps in a Hypothesis Test

Page 4: Hypothesis testing an introduction

DefinitionsDefinitions

In statistics, a In statistics, a hypothesishypothesis is an idea, an is an idea, an assumption, or a theory about the characteristics assumption, or a theory about the characteristics of one or more variables in one or more of one or more variables in one or more populations.populations.A A hypothesis testhypothesis test is a statistical procedure that is a statistical procedure that involves formulating a hypothesis and using involves formulating a hypothesis and using sample data to decide on the validity of the sample data to decide on the validity of the hypothesis.hypothesis.

Page 5: Hypothesis testing an introduction

Definitions (cont.)Definitions (cont.)

The The null hypothesisnull hypothesis is a statement about a is a statement about a parameter of the population. It is labeled parameter of the population. It is labeled HH00. . The The alternative hypothesisalternative hypothesis is a statement about a is a statement about a parameter of the population that is opposite to parameter of the population that is opposite to the null hypothesis. It is labeled the null hypothesis. It is labeled HHAA..A A test statistictest statistic is a number that captures the is a number that captures the information in the sample data. It is used to information in the sample data. It is used to decide between the null and alternative decide between the null and alternative hypotheses.hypotheses.

Page 6: Hypothesis testing an introduction

Definitions (cont.)Definitions (cont.)

The The significance levelsignificance level, , αα, is the maximum , is the maximum probability tolerated for rejecting a true null probability tolerated for rejecting a true null hypothesis.hypothesis.The The p valuep value is the probability of a more extreme is the probability of a more extreme departure from the null hypothesis than the departure from the null hypothesis than the observed data.observed data.

Page 7: Hypothesis testing an introduction

Definitions (cont.)Definitions (cont.)

The The rejection regionrejection region is the range of values of is the range of values of the test statistic that will lead us to reject the the test statistic that will lead us to reject the null hypothesis. It is defined by the critical null hypothesis. It is defined by the critical value. The area of the rejection region is value. The area of the rejection region is αα, the , the significance level.significance level.

Page 8: Hypothesis testing an introduction

GoalsGoals

To understand the difference between To understand the difference between estimation and testing.estimation and testing.To learn the 5 steps involved in a hypothesis To learn the 5 steps involved in a hypothesis test.test.

Page 9: Hypothesis testing an introduction

Estimation Versus TestingEstimation Versus Testing

Estimation is the process of providing a Estimation is the process of providing a numerical value (point) or values (interval) for numerical value (point) or values (interval) for a population parameter based on information a population parameter based on information in a sample.in a sample.Testing is a procedure for assessing whether Testing is a procedure for assessing whether sample data are consistent with statements sample data are consistent with statements (hypotheses) made about the population.(hypotheses) made about the population.

Page 10: Hypothesis testing an introduction

StepsSteps

Step 1Step 1: Set up the null and alternative : Set up the null and alternative hypotheses.hypotheses.Step 2Step 2: Define the test procedure (includes : Define the test procedure (includes selecting a test statistic, an selecting a test statistic, an αα level and a level and a rejection region).rejection region).Step 3Step 3: Collect the data and calculate the test : Collect the data and calculate the test statistic and the statistic and the pp value.value.Step 4Step 4: Decide whether to reject the null : Decide whether to reject the null hypothesis.hypothesis.

Page 11: Hypothesis testing an introduction

Steps (cont.)Steps (cont.)

Step 5Step 5: Interpret the results in the context of : Interpret the results in the context of the problem.the problem.

Page 12: Hypothesis testing an introduction

Section 7.6Section 7.6

LargeLarge--Sample Test of the Mean: Sample Test of the Mean: TwoTwo--Tail TestsTail Tests

Page 13: Hypothesis testing an introduction

DefinitionsDefinitions

A A largelarge--sample test of the meansample test of the mean is conducted is conducted when the characteristic of interest is the when the characteristic of interest is the population mean, population mean, µµ, and either of these , and either of these situations exists:situations exists:

the population standard deviation, the population standard deviation, σσ, is known , is known (regardless of sample size)(regardless of sample size)the population standard deviation, the population standard deviation, σσ, is unknown , is unknown but n but n ≥≥ 3030

Page 14: Hypothesis testing an introduction

Definitions (cont.)Definitions (cont.)

A A twotwo--tail test of the population meantail test of the population mean has has these null and alternative hypotheses:these null and alternative hypotheses:

HH00: : µµ = [specified number]= [specified number]HHAA: : µµ ≠≠ [specified number][specified number]

Page 15: Hypothesis testing an introduction

GoalGoal

To apply the 5 steps of a hypothesis test to a To apply the 5 steps of a hypothesis test to a twotwo--tail test of a population mean, tail test of a population mean, µµ, based on , based on information in a large sample (information in a large sample (nn ≥≥ 30).30).

Page 16: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

HumerusHumerus bones from the same species of bones from the same species of animal tend to have approximately the same animal tend to have approximately the same lengthlength--toto--width ratios.width ratios.For a particular species (Species A) the mean For a particular species (Species A) the mean ratio is 8.5.ratio is 8.5.Suppose 41 fossils of Suppose 41 fossils of humerushumerus bones of an bones of an unknown species were unearthed at an unknown species were unearthed at an archeological site.archeological site.

Page 17: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Suppose the lengthSuppose the length--toto--width ratios of the 41 width ratios of the 41 fossils were calculated.fossils were calculated.It is believed (hypothesized) that this site was It is believed (hypothesized) that this site was not populated by Species A.not populated by Species A.

Page 18: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Step 1Step 1: Set up the null and alternative : Set up the null and alternative hypotheses.hypotheses.Let Let µµ = the mean ratio for the site.= the mean ratio for the site.HH00: was populated by Species A: was populated by Species AHH00: : µµ = 8.5= 8.5HHAA: was not populated by Species A: was not populated by Species AHHAA: : µµ ≠≠ 8.58.5

Page 19: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Step 2Step 2: Define the test procedure.: Define the test procedure.

Consider as our test statistic Consider as our test statistic where where µµ00 = 8.5= 8.5This measures the distance of between the This measures the distance of between the mean ratio of the sample and the mean for mean ratio of the sample and the mean for Species A.Species A.We should reject We should reject HH00 for large values of |for large values of |ZZ|.|.

0XZs n− µ

=

Page 20: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Consider as our rejection region |Consider as our rejection region |ZZ| > | > zz..This means we reject This means we reject HH00 if if ZZ > > zz or or ZZ < < --zz..We need to choose We need to choose zz so thatso that

αα = = P(rejectP(reject a true a true HH00))= P(= P(ZZ > > zz) + P() + P(ZZ < < --zz), assuming ), assuming µµ = 8.5= 8.5

If If HH00 is true then is true then ZZ ~ ~ NN(0,1).(0,1).

Page 21: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

-z 0 z

α/2α/2

= -zα/2 = zα/2

Page 22: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

So we reject So we reject HH00 if |if |ZZ| > | > zzαα/2/2

Equivalently, reject Equivalently, reject HH00 if if ZZ > > zzαα/2/2 or or ZZ < < --zzαα/2/2

LetLet’’s choose s choose αα = 0.05= 0.05zzαα/2/2 = z= z.025.025 =1.96=1.96Reject Reject HH00 if if ZZ > 1.96 or > 1.96 or ZZ < < --1.961.96

Page 23: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Step 3Step 3: Collect the data and calculate the test : Collect the data and calculate the test statistic and the statistic and the pp value.value.For the For the nn = 41 ratios we have = 9.258 and = 41 ratios we have = 9.258 and ss= 1.404= 1.404

X

9.258 8.5 3.461.404 41

Z −= =

Page 24: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

pp value value = P(|Z| > |3.46|)= P(|Z| > |3.46|)= P(Z > 3.46) + P(Z < = P(Z > 3.46) + P(Z < --3.46)3.46)= 2P(Z < = 2P(Z < --3.46)3.46)= 2(.0003)= 2(.0003)= 0.0006= 0.0006

Page 25: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Step 4Step 4: Decide whether to reject the null : Decide whether to reject the null hypothesis.hypothesis.ZZ = 3.46= 3.46Rejection region: Rejection region: ZZ > 1.96 or > 1.96 or ZZ < < --1.961.96Reject Reject HH00: : µµ = 8.5= 8.5Accept Accept HHAA: : µµ ≠≠ 8.58.5

Page 26: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Step 5Step 5: Interpret the results in the context of : Interpret the results in the context of the problem.the problem.The fossils found at the site are not consistent The fossils found at the site are not consistent with those that would come from Species A.with those that would come from Species A.Hence, the site was not populated by species Hence, the site was not populated by species A.A.

Page 27: Hypothesis testing an introduction

pp Value Versus Value Versus αα

The The pp value is the smallest value of value is the smallest value of αα for for which we could reject which we could reject HH00..If If pp value < value < αα then reject then reject HH00..If If pp value value ≥≥ αα then do not reject then do not reject HH00..A A pp value can be used in place of a rejection value can be used in place of a rejection region.region.

Page 28: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

αα = 0.05= 0.05pp value = 0.0006value = 0.0006pp value < value < ααReject Reject HH00: : µµ = 8.5= 8.5

Page 29: Hypothesis testing an introduction

Section 7.7Section 7.7

What Error Could You Be What Error Could You Be Making?Making?

Page 30: Hypothesis testing an introduction

DefinitionsDefinitions

A A Type I errorType I error is made when we reject the null is made when we reject the null hypothesis and the null hypothesis is actually hypothesis and the null hypothesis is actually true.true.A A Type II errorType II error is made when we fail to reject is made when we fail to reject the null hypothesis and the null hypothesis is the null hypothesis and the null hypothesis is actually false.actually false.The probability of making a Type I error is The probability of making a Type I error is labeled labeled αα..The probability of making a Type II error is The probability of making a Type II error is labeled labeled ββ..

Page 31: Hypothesis testing an introduction

GoalGoal

To learn from our mistakes.To learn from our mistakes.

Page 32: Hypothesis testing an introduction

Truth versus DecisionTruth versus Decision

Right choiceRight choiceType I errorType I errorBelieve Believe HHAA

Type II errorType II errorRight choiceRight choiceBelieve Believe HH00

HHAA truetrueHH00 truetrueDecisionDecision

TruthTruth

Page 33: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

HH00: site : site waswas populated by Species Apopulated by Species AHH00: : µµ = 8.5= 8.5HHAA: site : site waswas notnot populated by Species Apopulated by Species AHHAA: : µµ ≠≠ 8.58.5Type I error = conclude the site Type I error = conclude the site waswas notnotpopulated by Species A when it actually populated by Species A when it actually waswas..

Page 34: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Type II error = conclude the site Type II error = conclude the site waswas populated populated by Species A when it actually by Species A when it actually waswas notnot..

Page 35: Hypothesis testing an introduction

Choosing Choosing αα

So far our hypothesis tests allow us to choose So far our hypothesis tests allow us to choose αα..In many (but not all) applications a Type I In many (but not all) applications a Type I error is more costly than a Type II error.error is more costly than a Type II error.As As αα decreases, decreases, ββ increases.increases.As As ββ decreases, decreases, αα increases.increases.Whichever error is the most costly is the Whichever error is the most costly is the probability of which you need to minimize.probability of which you need to minimize.

Page 36: Hypothesis testing an introduction

Example Example –– HumerusHumerus BonesBones

Suppose it would be most embarrassing to Suppose it would be most embarrassing to claim that the site was not populated by claim that the site was not populated by Species A when it actually was.Species A when it actually was.Make Make αα small (small (αα = 0.01).= 0.01).Suppose it would cost you your academic Suppose it would cost you your academic career to say that the site was populated by career to say that the site was populated by species A when it actually was not.species A when it actually was not.Make Make ββ small (small (αα = 0.10).= 0.10).

Page 37: Hypothesis testing an introduction

Reject Reject HH00 Versus DonVersus Don’’t Reject t Reject HH00

Clearly, if we reject Clearly, if we reject HH00 then we accept then we accept HHAA..However, if we do not reject However, if we do not reject HH00 does this does this imply that we accept imply that we accept HH00??No. At least not in this class.No. At least not in this class.Type I error = reject a true Type I error = reject a true HH00

P(TypeP(Type I error) = I error) = αα (known)(known)Type II error = accept a false Type II error = accept a false HH00

P(TypeP(Type II error) = II error) = ββ (unknown, for now)(unknown, for now)

Page 38: Hypothesis testing an introduction

Reject Reject HH00 Versus DonVersus Don’’t Reject t Reject HH00

Since we know Since we know αα we will allow ourselves the we will allow ourselves the risk of rejecting risk of rejecting HH00 when when HH00 is true.is true.However, since we do not know However, since we do not know ββ we will not we will not risk accepting risk accepting HH00 when when HH00 is false.is false.If we do not reject If we do not reject HH00 we will conclude that we will conclude that there is insufficient evidence in the sample to there is insufficient evidence in the sample to say say HH00 is false.is false.

Page 39: Hypothesis testing an introduction

Section 7.8Section 7.8

Which Theory Should Go into Which Theory Should Go into the Null Hypothesis?the Null Hypothesis?

Page 40: Hypothesis testing an introduction

DefinitionsDefinitions

A A twotwo--tail testtail test of the population mean has of the population mean has these null and alternative hypotheses:these null and alternative hypotheses:

HH00: : µµ = = µµ00

HHAA: : µµ ≠≠ µµ00

A A lowerlower--tail testtail test of the population mean has of the population mean has these null and alternative hypotheses:these null and alternative hypotheses:

HH00: : µµ ≥≥ µµ00

HHAA: : µµ < < µµ00

Page 41: Hypothesis testing an introduction

Definitions (cont.)Definitions (cont.)

An An upperupper--tail testtail test of the population mean has of the population mean has these null and alternative hypotheses:these null and alternative hypotheses:

HH00: : µµ ≤≤ µµ00

HHAA: : µµ > > µµ00

Page 42: Hypothesis testing an introduction

TwoTwo--Tail TestsTail Tests

HH00: : µµ = = µµ00

HHAA: : µµ ≠≠ µµ00

HHAA: : µµ > > µµ00 or or µµ < < µµ00

In these cases we wish to show that the mean In these cases we wish to show that the mean is not some specified value (research is not some specified value (research hypothesis).hypothesis).With this end, we assume the complement to With this end, we assume the complement to be true (be true (HH00) until we have sufficient evidence ) until we have sufficient evidence to reject to reject HH00 (accept (accept HHAA).).

Page 43: Hypothesis testing an introduction

Example Example –– HumerusHumerus BoneBone

µµ = mean ratio for the site= mean ratio for the siteHHAA: : µµ ≠≠ 8.58.5HHAA: : µµ < 8.5 or < 8.5 or µµ > 8.5> 8.5HH00: : µµ = 8.5= 8.5

Page 44: Hypothesis testing an introduction

LowerLower--Tail TestsTail Tests

HH00: : µµ ≥≥ µµ00

HHAA: : µµ < < µµ00

In these cases we usually wish to show that the In these cases we usually wish to show that the mean is less than some specified value mean is less than some specified value (research hypothesis).(research hypothesis).With this end, we assume the complement to With this end, we assume the complement to be true (be true (HH00) until we have sufficient evidence ) until we have sufficient evidence to reject to reject HH00 (accept (accept HHAA).).

Page 45: Hypothesis testing an introduction

Example Example –– Vending MachineVending Machine

µµ = average amount of beverage dispensed into = average amount of beverage dispensed into a 12 ounce cupa 12 ounce cupYou believe that you are being ripped off by You believe that you are being ripped off by this vending machine, i.e., this vending machine, i.e., µµ < 12 ounces.< 12 ounces.HHAA: : µµ < 12 ounces< 12 ouncesHH00: : µµ ≥≥ 12 ounces12 ounces

Page 46: Hypothesis testing an introduction

UpperUpper--Tail TestsTail Tests

HH00: : µµ ≤≤ µµ00

HHAA: : µµ > > µµ00

In these cases we usually wish to show that the In these cases we usually wish to show that the mean is greater than some specified value mean is greater than some specified value (research hypothesis).(research hypothesis).With this end, we assume the complement to With this end, we assume the complement to be true (be true (HH00) until we have sufficient evidence ) until we have sufficient evidence to reject to reject HH00 (accept (accept HHAA).).

Page 47: Hypothesis testing an introduction

Example Example –– Grade InflationGrade Inflation

µµ = = 20042004--0505 GPA at UCFGPA at UCFThe historical average is 2.7The historical average is 2.7Suppose you wish to show that UCF is Suppose you wish to show that UCF is currently experiencing grade inflation, i.e., currently experiencing grade inflation, i.e., µµ > > 2.72.7HHAA: : µµ > 2.7> 2.7HH00: : µµ ≤≤ 2.72.7

Page 48: Hypothesis testing an introduction

Section 7.9Section 7.9

OneOne--Tail Tests of the Mean: Tail Tests of the Mean: Large SampleLarge Sample

Page 49: Hypothesis testing an introduction

LowerLower--Tail TestTail Test

HH00: : µµ ≥≥ µµ00 versus versus HHAA: : µµ < < µµ00

Test statistic: Test statistic:

Rejection region: Z < zRejection region: Z < zαα = P(Z < z), given = P(Z < z), given HH00 truetrue

0XZs n− µ

=

Page 50: Hypothesis testing an introduction

α

z = -zα0

Page 51: Hypothesis testing an introduction

LowerLower--Tail TestTail Test

z = z = --zzααRejection region: Z < Rejection region: Z < --zzααpp value = P(Z < observed Z)value = P(Z < observed Z)

Page 52: Hypothesis testing an introduction

UpperUpper--Tail TestTail Test

HH00: : µµ ≤≤ µµ00 versus versus HHAA: : µµ > > µµ00

Test statistic: Test statistic:

Rejection region: Z > zRejection region: Z > zαα = P(Z > z), given = P(Z > z), given HH00 truetrue

0XZs n− µ

=

Page 53: Hypothesis testing an introduction

α

z = zα0

Page 54: Hypothesis testing an introduction

UpperUpper--Tail TestTail Test

z = zz = zααRejection region: Z > zRejection region: Z > zααpp value = P(Z > observed Z)value = P(Z > observed Z)

Page 55: Hypothesis testing an introduction

Example Example –– Grade InflationGrade Inflation

µµ = = 20042004--0505 GPA at UCFGPA at UCFThe historical average is 2.7The historical average is 2.7Suppose you wish to show that UCF is Suppose you wish to show that UCF is currently experiencing grade inflation.currently experiencing grade inflation.Suppose that from a sample of 64 students we Suppose that from a sample of 64 students we had an average GPA of 2.85 with a standard had an average GPA of 2.85 with a standard deviation of 0.55.deviation of 0.55.

Page 56: Hypothesis testing an introduction

Example Example –– Grade InflationGrade Inflation

Let the Type I error be 0.05.Let the Type I error be 0.05.Step 1:Step 1:

HHAA: : µµ > 2.7> 2.7HH00: : µµ ≤≤ 2.72.7

Step 2:Step 2:Test statistic:Test statistic:αα = 0.05= 0.05Rejection region: Z > zRejection region: Z > z0.050.05 = 1.645= 1.645

µ−= 0XZs n

Page 57: Hypothesis testing an introduction

Example Example –– Grade InflationGrade Inflation

Step 3:Step 3:Test statistic:Test statistic:

pp value = P(Z > 2.18) = 0.0146value = P(Z > 2.18) = 0.0146

Step 4:Step 4:Reject Reject HH00

−= =2.85 2.7 2.180.55 64

Z

Page 58: Hypothesis testing an introduction

Example Example –– Grade InflationGrade Inflation

Step 5:Step 5:The sample data indicates that we are currently The sample data indicates that we are currently experiencing grade inflation.experiencing grade inflation.