two-sample tests samples comparing two means: paired samples comparing two proportions ... ·  ·...

25
1/5/2018 1 McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc. Two Two-Sample Hypothesis Sample Hypothesis Testing Testing Chapter 10 10 10 10 Two-Sample Tests Comparing Two Means: Independent Samples Comparing Two Means: Paired Samples Comparing Two Proportions Comparing Two Variances 10-2 Two Two-Sample Tests Sample Tests A Two A Two-sample test compares two sample sample test compares two sample estimates with each other. estimates with each other. A one A one-sample test compares a sample sample test compares a sample estimate against a non estimate against a non-sample benchmark. sample benchmark. What is a Two What is a Two-Sample Test Sample Test Basis of Two Basis of Two-Sample Tests Sample Tests Two samples that are drawn from the same Two samples that are drawn from the same population may yield different estimates of population may yield different estimates of a parameter due to chance. a parameter due to chance.

Upload: lamkien

Post on 28-May-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

1/5/2018

1

McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc.

TwoTwo--Sample HypothesisSample HypothesisTestingTesting

Chapter10101010

Two-Sample TestsComparing Two Means: Independent

SamplesComparing Two Means: Paired

SamplesComparing Two ProportionsComparing Two Variances

10-2

TwoTwo--Sample TestsSample Tests

•• A TwoA Two--sample test compares two samplesample test compares two sampleestimates with each other.estimates with each other.

•• A oneA one--sample test compares a samplesample test compares a sampleestimate against a nonestimate against a non--sample benchmark.sample benchmark.

What is a TwoWhat is a Two--Sample TestSample Test

Basis of TwoBasis of Two--Sample TestsSample Tests•• Two samples that are drawn from the sameTwo samples that are drawn from the same

population may yield different estimates ofpopulation may yield different estimates ofa parameter due to chance.a parameter due to chance.

1/5/2018

2

10-3

TwoTwo--Sample TestsSample Tests

•• If the two sample statistics differ by moreIf the two sample statistics differ by morethan the amount attributable to chance,than the amount attributable to chance,then we conclude that the samples camethen we conclude that the samples camefrom populations with different parameterfrom populations with different parametervalues.values.

What is a TwoWhat is a Two--Sample TestSample Test

Figure 10.1

10-4

TwoTwo--Sample TestsSample Tests

•• State the hypothesesState the hypotheses•• Set up the decision ruleSet up the decision rule•• Insert the sample statisticsInsert the sample statistics•• Make a decision based on the criticalMake a decision based on the critical

values or usingvalues or using pp--valuesvalues•• If our decision is wrong, we could commit aIf our decision is wrong, we could commit a

type I or type II error.type I or type II error.•• Larger samples are needed to reduce type ILarger samples are needed to reduce type I

or type II errors.or type II errors.

Test ProcedureTest Procedure

1/5/2018

3

10-5

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• The hypotheses for comparing twoThe hypotheses for comparing twoindependent population meansindependent population meansmm11 andandmm22are:are:

Format of HypothesesFormat of Hypotheses

10-6

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• If the population variancesIf the population variancesss1122 andandss22

22 areareknown, then use the normal distribution.known, then use the normal distribution.

•• If population variances are unknown andIf population variances are unknown andestimated usingestimated using ss11

22 andand ss2222, then use the, then use the

StudentsStudents tt distribution.distribution.

Test StatisticTest Statistic

Table 10.1

1/5/2018

4

10-7

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• Excel’s Tools | Data Analysis menu handlesExcel’s Tools | Data Analysis menu handlesall three cases.all three cases.

Test StatisticTest Statistic

Figure 10.2

10-8

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• When the variances are known, use theWhen the variances are known, use thenormal distribution for the test (assuming anormal distribution for the test (assuming anormal population).normal population).

•• The test statistic is:The test statistic is:

CaseCase 11: Known Variances: Known Variances

1/5/2018

5

10-9

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• Since the variances are unknown, theySince the variances are unknown, theymust be estimated and the Student’smust be estimated and the Student’s ttdistribution used to test the means.distribution used to test the means.

•• Assuming the population variances areAssuming the population variances areequal,equal, ss11

22 andand ss2222 can be used to estimate acan be used to estimate a

common pooled variancecommon pooled variance sspp22..

CaseCase 22: Unknown Variances, Assumed Equal: Unknown Variances, Assumed Equal

10-10

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• The test statistic isThe test statistic isCase 2: Unknown Variances, Assumed EqualCase 2: Unknown Variances, Assumed Equal

•• With degrees of freedomWith degrees of freedomnn== nn11 ++ nn22 -- 22

1/5/2018

6

10-11

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• If the unknown variances are assumed toIf the unknown variances are assumed tobe unequal, they are not pooled together.be unequal, they are not pooled together.

CaseCase 33: Unknown Variances, Assumed Unequal: Unknown Variances, Assumed Unequal

•• In this case, the distribution of the randomIn this case, the distribution of the randomvariablevariable xx11 –– xx22 is not certain (Behrensis not certain (Behrens--Fisher problem).Fisher problem).

•• Use the WelchUse the Welch--SatterthwaiteSatterthwaite test whichtest whichreplacesreplacesss11

22 andandss2222 withwith ss11

22 andand ss2222 in thein the

known varianceknown variance zz formula, then uses aformula, then uses aStudent’sStudent’s tt test with adjusted degrees oftest with adjusted degrees offreedom.freedom.

10-12

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

CaseCase 33: Unknown Variances, Assumed Unequal: Unknown Variances, Assumed Unequal

•• WelchWelch--SatterthwaiteSatterthwaite testtest

•• with degrees of freedomwith degrees of freedom

•• A Quick Rule for degrees of freedom is toA Quick Rule for degrees of freedom is touse min(use min(nn11 –– 11,, nn22 –– 11).).

1/5/2018

7

10-13

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• StepStep 11: State the hypotheses: State the hypotheses

•• StepStep 22:: SpecifySpecify the decision rulethe decision ruleChooseChooseaa(the level of significance) and(the level of significance) anddetermine the critical value(s).determine the critical value(s).

•• StepStep 33: Calculate the Test Statistic: Calculate the Test Statistic

Steps in Testing Two MeansSteps in Testing Two Means

10-14

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• StepStep 44: Make the decision: Make the decisionRejectReject HH00 if the test statistic falls in theif the test statistic falls in therejection region(s) as defined by the criticalrejection region(s) as defined by the criticalvalue(s).value(s).

Steps in Testing Two MeansSteps in Testing Two Means

For example,for a two-tailedtest forStudent’s tand α = .05

Figure 10.4

1/5/2018

8

10-15

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

•• If the sample sizes are equal, theIf the sample sizes are equal, the CaseCase 22andand CaseCase 33 test statistics will be identical,test statistics will be identical,although the degrees of freedom mayalthough the degrees of freedom maydiffer.differ.

•• If the variances are similar, the two testsIf the variances are similar, the two testswill usually agree.will usually agree.

•• If no information about the populationIf no information about the populationvariances is available, then the best choicevariances is available, then the best choiceisis CaseCase 33..

•• The fewer assumptions, the better.The fewer assumptions, the better.

Which Assumption Is Best?Which Assumption Is Best?

10-16

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

Must Sample Sizes Be Equal?Must Sample Sizes Be Equal?•• Unequal sample sizes are common and theUnequal sample sizes are common and the

formulas still apply.formulas still apply.Large SamplesLarge Samples

•• For unknown variances, if both samplesFor unknown variances, if both samplesare large (are large (nn11 >> 3030 andand nn22 >> 3030) and the) and thepopulation isn’t badly skewed, use thepopulation isn’t badly skewed, use thefollowing formula with appendix C.following formula with appendix C.

1/5/2018

9

10-17

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

Caution: Three IssuesCaution: Three Issues1.1. Are the populations skewed? Are thereAre the populations skewed? Are there

outliers?outliers?Check using histograms and dot plots ofCheck using histograms and dot plots ofeach sample.each sample.tt tests are OK if moderately skewed,tests are OK if moderately skewed,especially if samples are large.especially if samples are large.Outliers are more serious.Outliers are more serious.

10-18

Comparing Two Means:Comparing Two Means:Independent SamplesIndependent Samples

Caution: Three IssuesCaution: Three Issues2.2. Are the sample sizes largeAre the sample sizes large (n(n >> 3030)?)?

If samples are small, the mean is not aIf samples are small, the mean is not areliable indicator of central tendency andreliable indicator of central tendency andthe test may lack power.the test may lack power.

3.3. Is the differenceIs the difference importantimportant as well asas well assignificant?significant?A small difference in means or proportionsA small difference in means or proportionscould be significant if the sample size iscould be significant if the sample size islarge.large.

1/5/2018

10

10-19

Comparing Two Means:Comparing Two Means:Paired SamplesPaired Samples

Paired DataPaired Data•• Data occurs in matched pairs when theData occurs in matched pairs when the

same item is observed twice but undersame item is observed twice but underdifferent circumstances.different circumstances.

•• For example, blood pressure is takenFor example, blood pressure is takenbefore and after a treatment is given.before and after a treatment is given.

•• Paired data are typically displayed inPaired data are typically displayed incolumns:columns:

10-20

Comparing Two Means:Comparing Two Means:Paired SamplesPaired Samples

Paired t TestPaired t Test•• Paired data typically come from aPaired data typically come from a

before/after experiment.before/after experiment.•• In the pairedIn the paired tt test, the difference betweentest, the difference between

xx11 andand xx22 is measured asis measured as dd == xx11 –– xx22

•• The meanThe mean dd and standard deviationand standard deviation ssdd ofofthe sample ofthe sample of nn differences are calculateddifferences are calculatedwith the usual formulas for a mean andwith the usual formulas for a mean andstandard deviation.standard deviation.

1/5/2018

11

10-21

Comparing Two Means:Comparing Two Means:Paired SamplesPaired Samples

Paired t TestPaired t Test•• The calculations for the mean and standardThe calculations for the mean and standard

deviation are:deviation are:

•• Since the populationSince the populationvariance ofvariance of dd is unknown,is unknown,use the Student’suse the Student’s tt withwith nn--11degrees of freedom.degrees of freedom.

10-22

Comparing Two Means:Comparing Two Means:Paired SamplesPaired Samples

•• StepStep 11: State the hypotheses, for example: State the hypotheses, for exampleHH00::mmdd == 00HH11::mmdd ≠≠ 00

•• StepStep 22: Specify the decision rule.: Specify the decision rule.ChooseChooseaa(the level of(the level ofsignificance) andsignificance) anddetermine the criticaldetermine the criticalvalues from Appendix D.values from Appendix D.

Steps in Testing Paired DataSteps in Testing Paired Data

1/5/2018

12

10-23

Comparing Two Means:Comparing Two Means:Paired SamplesPaired Samples

•• StepStep 33: Calculate the test statistic: Calculate the test statistic tt•• StepStep 44: Make the decision: Make the decision

RejectReject HH00 if the test statistic falls in theif the test statistic falls in therejection region(s) as defined by therejection region(s) as defined by thecritical values.critical values.

Steps in Testing Paired DataSteps in Testing Paired Data

10-24

Comparing Two Means:Comparing Two Means:Paired SamplesPaired Samples

•• Excel gives you the option of choosingExcel gives you the option of choosingeither a oneeither a one--tailed or twotailed or two--tailed test andtailed test andalso gives thealso gives the pp--value.value.

Excel’s Paired Difference TestExcel’s Paired Difference Test

1/5/2018

13

10-25

Comparing Two Means:Comparing Two Means:Paired SamplesPaired Samples

•• A twoA two--tailed test for a zero difference istailed test for a zero difference isequivalent to asking whether theequivalent to asking whether theconfidence interval for the true meanconfidence interval for the true meandifferencedifferencemmdd includes zero.includes zero.

Analogy to Confidence IntervalAnalogy to Confidence Interval

10-26

Comparing Two ProportionsComparing Two Proportions

•• To compare two population proportions,To compare two population proportions,pp11,,pp22, use the following hypotheses, use the following hypotheses

Testing for Zero Difference:Testing for Zero Difference: pp11 ==pp22

1/5/2018

14

10-27

Comparing Two ProportionsComparing Two Proportions

•• The sample proportionThe sample proportion pp11 is a pointis a pointestimateestimate ofofpp11::

Testing for Zero Difference:Testing for Zero Difference: pp11 ==pp22

•• The sample proportionThe sample proportion pp22 is a pointis a pointestimate ofestimate ofpp22::

10-28

Comparing Two ProportionsComparing Two Proportions

•• IfIf HH00 is true, there is no difference betweenis true, there is no difference betweenpp11 andandpp22, so the samples are pooled, so the samples are pooled(averaged) into one “big” sample to(averaged) into one “big” sample toestimate the common populationestimate the common populationproportion.proportion.

Pooled ProportionPooled Proportion

== number of successes in combined samplesnumber of successes in combined samplescombined sample sizecombined sample sizepp ==

xx11 ++ xx22nn11 ++ nn22

1/5/2018

15

10-29

Comparing Two ProportionsComparing Two Proportions

•• If the samples are large,If the samples are large, pp11 –– pp22 may bemay beassumed normally distributed.assumed normally distributed.

•• The test statistic is the difference of theThe test statistic is the difference of thesample proportions divided by thesample proportions divided by thestandard error of the difference.standard error of the difference.

•• The standard error is calculated by usingThe standard error is calculated by usingthe pooled proportion.the pooled proportion.

•• The test statistic for theThe test statistic for thehypothesishypothesis pp11 ==pp22 is:is:

Test StatisticTest Statistic

10-30

Comparing Two ProportionsComparing Two Proportions

•• The test statistic for the hypothesisThe test statistic for the hypothesis pp11 ==pp22may also be written as:may also be written as:

Test StatisticTest Statistic

1/5/2018

16

10-31

Comparing Two ProportionsComparing Two Proportions

•• StepStep 11: State the hypotheses: State the hypotheses•• StepStep 22:: SpecifySpecify the decision rulethe decision rule

ChooseChooseaa(the level of significance) and(the level of significance) anddetermine the critical value(s).determine the critical value(s).

•• StepStep 33: Calculate the Test Statistic: Calculate the Test StatisticAssuming thatAssuming thatpp11 ==pp22, use a pooled, use a pooledestimate of the common proportion.estimate of the common proportion.

Steps in Testing Two ProportionsSteps in Testing Two Proportions

10-32

Comparing Two ProportionsComparing Two Proportions

•• StepStep 44: Make the decision: Make the decisionRejectReject HH00 if the test statistic falls in theif the test statistic falls in therejection region(s) as defined by the criticalrejection region(s) as defined by the criticalvalue(s).value(s).

Steps in Testing Two ProportionsSteps in Testing Two Proportions

For example, fora two-tailed testand α = .05

1/5/2018

17

10-33

Comparing Two ProportionsComparing Two Proportions

•• TheThe pp--value is the level of significance thatvalue is the level of significance thatallows us to rejectallows us to reject HH00..

•• TheThe pp--value indicates the probability that avalue indicates the probability that asample result would occur by chance ifsample result would occur by chance if HH00were true.were true.

•• TheThe pp--value can be obtained from Appendixvalue can be obtained from AppendixCC--22 or Excel using =NORMDIST(or Excel using =NORMDIST(zz).).

•• A smallerA smaller pp--value indicates a morevalue indicates a moresignificant difference.significant difference.

Using the pUsing the p--ValueValue

10-34

Comparing Two ProportionsComparing Two Proportions

•• Check the normality assumption withCheck the normality assumption withnnpp>> 1010 andand nn((11--pp)) >> 1010..

•• Each of the two samples must be checkedEach of the two samples must be checkedseparately using each sample proportion inseparately using each sample proportion inplace ofplace ofpp..

•• If either sample proportion is not normal, theirIf either sample proportion is not normal, theirdifference cannot safely be assumed normal.difference cannot safely be assumed normal.

•• The sample size rule of thumb is equivalent toThe sample size rule of thumb is equivalent torequiring that each sample contains at leastrequiring that each sample contains at least 1010“successes” and at least“successes” and at least 1010 “failures.”“failures.”

Checking NormalityChecking Normality

1/5/2018

18

10-35

Comparing Two ProportionsComparing Two Proportions

•• If sample sizes do not justify the normalityIf sample sizes do not justify the normalityassumption, treat each sample as aassumption, treat each sample as abinomial experiment.binomial experiment.

•• If the samples are small, the test is likely toIf the samples are small, the test is likely tohave low power.have low power.

Small SamplesSmall Samples

Must Sample Sizes Be Equal?Must Sample Sizes Be Equal?•• Unequal sample sizes are common and theUnequal sample sizes are common and the

formulas still apply.formulas still apply.

10-36

Comparing Two ProportionsComparing Two Proportions

•• MegaStatMegaStat gives the option of enteringgives the option of enteringsample proportions or the fractions.sample proportions or the fractions.

•• MINITAB gives the option ofMINITAB gives the option of nonpoolednonpooledproportions.proportions.

Using Software for CalculationsUsing Software for Calculations

Figure 10.15

1/5/2018

19

10-37

Comparing Two ProportionsComparing Two Proportions

•• The confidence interval forThe confidence interval forpp11 ––pp22 withoutwithoutpooling the samples is:pooling the samples is:

Analogy to Confidence IntervalsAnalogy to Confidence Intervals

•• If the confidence interval does not includeIf the confidence interval does not include00, then we reject the null hypothesis., then we reject the null hypothesis.

10-38

Comparing Two ProportionsComparing Two Proportions

•• Testing for equality is a special case ofTesting for equality is a special case oftestingtesting forfor a specified differencea specified difference DD00between two proportions.between two proportions.

Testing for NonTesting for Non--Zero Differences (Optional)Zero Differences (Optional)

•• If the hypothesized differenceIf the hypothesized difference DD00 is nonis non--zero, the test statistic is:zero, the test statistic is:

1/5/2018

20

10-39

Comparing Two VariancesComparing Two Variances

•• To test whether two population means areTo test whether two population means areequal, we may also need to test whetherequal, we may also need to test whethertwo population variances are equal.two population variances are equal.

•• The hypotheses may be stated asThe hypotheses may be stated as

Format of HypothesesFormat of Hypotheses

10-40

Comparing Two VariancesComparing Two Variances

•• An equivalent way to state theseAn equivalent way to state thesehypotheses would be to use ratios sincehypotheses would be to use ratios sincethe variance can never be less than zerothe variance can never be less than zeroand it would not make sense to take theand it would not make sense to take thedifference between two variances.difference between two variances.

Format of HypothesesFormat of Hypotheses

1/5/2018

21

10-41

Comparing Two VariancesComparing Two Variances

•• The test statistic is the ratio of the sampleThe test statistic is the ratio of the samplevariances:variances:

The F TestThe F Test

•• If the variances are equal, this ratio shouldIf the variances are equal, this ratio shouldbe near unity:be near unity: FF 11

10-42

Comparing Two VariancesComparing Two Variances

•• If the test statistic is far belowIf the test statistic is far below 11 or aboveor above 11,,we would reject the hypothesis of equalwe would reject the hypothesis of equalpopulation variances.population variances.

•• The numeratorThe numerator ss1122 has degrees of freedomhas degrees of freedom

nn11 == nn11 –– 11 and the denominatorand the denominator ss2222 hashas

degrees of freedomdegrees of freedomnn22 == nn22 –– 11..•• TheThe FF distribution isdistribution is

skewed withskewed with the mean >the mean > 11and itsand its mode <mode < 11..

The F TestThe F Test

1/5/2018

22

Comparing Two VariancesComparing Two Variances

•• Critical values for theCritical values for the FF test are denotedtest are denotedFFLL (left tail) and(left tail) and FFRR (right tail).(right tail).

•• A rightA right--tail critical valuetail critical value FFRR may be found frommay be found fromAppendix F usingAppendix F using nn11 andandnn22 degrees ofdegrees offreedom.freedom.

FFRR == FFnn11,,nn22

•• A leftA left--tail critical valuetail critical value FFRR may be found bymay be found byreversing the numerator and denominatorreversing the numerator and denominatordegrees of freedom, finding the critical valuedegrees of freedom, finding the critical valuefrom Appendix F and taking its reciprocal:from Appendix F and taking its reciprocal:

FFLL == 11//FFnn22,,nn11

The F TestThe F Test

10-43

10-44

Comparing Two VariancesComparing Two Variances

•• StepStep 11: State the hypotheses, for example: State the hypotheses, for exampleHH00::ss11

22 ==ss2222

HH11::ss1122 ≠≠ss22

22

•• StepStep 22: Specify the decision rule: Specify the decision ruleDegrees of freedom are:Degrees of freedom are:

Numerator:Numerator: nn11 == nn11 –– 11Denominator:Denominator:nn22 == nn22 –– 11

ChooseChooseaaand find the leftand find the left--tail and righttail and right--tailtailcritical values from Appendix F.critical values from Appendix F.

Steps in Testing Two VariancesSteps in Testing Two Variances

1/5/2018

23

10-45

Comparing Two VariancesComparing Two Variances

•• StepStep 33: Calculate the test statistic: Calculate the test statistic•• StepStep 44: Make the decision: Make the decision

RejectReject HH00 if the test statistic falls in theif the test statistic falls in therejection regions as defined by the criticalrejection regions as defined by the criticalvalues.values.

Steps in Testing Two VariancesSteps in Testing Two Variances

10-46

Comparing Two VariancesComparing Two Variances

Comparison of Variances: One Tailed TestComparison of Variances: One Tailed Test•• StepStep 11: State the hypotheses, for example: State the hypotheses, for example

HH00::ss1122 ==ss22

22

HH11::ss1122 <<ss22

22

•• StepStep 22: State the decision rule: State the decision ruleDegrees of freedom are:Degrees of freedom are:

Numerator:Numerator: nn11 == nn11 –– 11Denominator:Denominator:nn22 == nn22 –– 11

ChooseChooseaaand find the leftand find the left--tail critical valuetail critical valuefrom Appendix F.from Appendix F.

1/5/2018

24

10-47

Comparing Two VariancesComparing Two Variances

Comparison of Variances: One Tailed TestComparison of Variances: One Tailed Test

•• StepStep 33: Calculate the Test Statistic: Calculate the Test Statistic FF•• StepStep 44: Make the decision: Make the decision

RejectReject HH00 if the test statistic falls in the leftif the test statistic falls in the left--tail rejection region as defined by thetail rejection region as defined by thecritical value.critical value.

10-48

Comparing Two VariancesComparing Two Variances

Excel’s F TestExcel’s F Test•• Excel allows you to test the equality ofExcel allows you to test the equality of

variances and gives you avariances and gives you a pp--value.value.

Figure 10.26

1/5/2018

25

10-49

Comparing Two VariancesComparing Two Variances

Assumptions of the F TestAssumptions of the F Test

•• TheThe FF test assumes that the populationstest assumes that the populationsbeing sampled are normal.being sampled are normal.

•• It is sensitive to nonIt is sensitive to non--normality of thenormality of thesampled populations.sampled populations.

•• Often, the samples used in theOften, the samples used in the FF test aretest aretoo small for a normality test.too small for a normality test.

McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc.

Applied Statistics inApplied Statistics inBusiness & EconomicsBusiness & Economics

End of Chapter 10End of Chapter 10

10-50