sda 3e chapter 5

Upload: xinearpinger

Post on 07-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 SDA 3E Chapter 5

    1/62

    2007 Pearson Education

    Chapter 5: Hypothesis Testingand Statistical Inference

  • 8/4/2019 SDA 3E Chapter 5

    2/62

    Hypothesis Testing Hypothesis testing involves drawing

    inferences about two contrasting propositions

    (hypotheses) relating to the value of apopulation parameter, one of which isassumed to be true in the absence ofcontradictory data.

    We seek evidence to determine if thehypothesis can be rejected; if not, we canonly assume it to be true but have notstatistically proven it true.

  • 8/4/2019 SDA 3E Chapter 5

    3/62

    Hypothesis Testing Procedure1. Formulate the hypothesis

    2. Select a level of significance, which defines

    the risk of drawing an incorrect conclusionthat a true hypothesis is false

    3. Determine a decision rule

    4. Collect data and calculate a test statistic5. Apply the decision rule and draw a

    conclusion

  • 8/4/2019 SDA 3E Chapter 5

    4/62

    Hypothesis Formulation Null hypothesis, H0 a statement that is

    accepted as correct

    Alternative hypothesis, H1 a proposition thatmust be true if H0 is false

    Formulating the correct set of hypothesesdepends on burden of proof what you

    wish to prove statistically should be H1 Tests involving a single population parameter

    are called one-sample tests; tests involvingtwo populations are called two-sample tests.

  • 8/4/2019 SDA 3E Chapter 5

    5/62

    Types of Hypothesis Tests One Sample Tests

    H0: population parameter constant vs.

    H1: population parameter < constant

    H0: population parameter constant vs.H

    1: population parameter > constant

    H0: population parameter = constant vs.

    H1: population parameter constant

    Two Sample Tests H

    0: population parameter (1) - population parameter (2) 0 vs.

    H1: population parameter (1) - population parameter (2) < 0

    H0: population parameter (1) - population parameter (2) 0 vs.

    H1: population parameter (1) - population parameter (2) > 0

    H0: population parameter (1) - population parameter (2) = 0 vs.H

    1: population parameter (1) - population parameter (2) 0

  • 8/4/2019 SDA 3E Chapter 5

    6/62

    Four Outcomes1. The null hypothesis is actually true, and the

    test correctly fails to reject it.

    2. The null hypothesis is actually false, and thehypothesis test correctly reaches thisconclusion.

    3. The null hypothesis is actually true, but the

    hypothesis test incorrectly rejects it (Type Ierror).

    4. The null hypothesis is actually false, but thehypothesis test incorrectly fails to reject it

    (Type II error).

  • 8/4/2019 SDA 3E Chapter 5

    7/62

    Quantifying Outcomes Probability of Type I error (rejecting H0 when

    it is true) = = level of significance Probability ofcorrectly failingto reject H0 = 1

    = confidence coefficient Probability of Type II error (failing to reject H0

    when it is false) = Probability ofcorrectly rejectingH0 when it is

    false = 1 = power of the test

  • 8/4/2019 SDA 3E Chapter 5

    8/62

    Decision Rules Compute a test statistic from sample data and

    compare it to the hypothesized sampling

    distribution of the test statistic Divide the sampling distribution into a

    rejection region and non-rejection region.

    If the test statistic falls in the rejection region,reject H0 (concluding that H1 is true);

    otherwise, fail to reject H0

  • 8/4/2019 SDA 3E Chapter 5

    9/62

    Rejection Regions

  • 8/4/2019 SDA 3E Chapter 5

    10/62

    Hypothesis Tests and

    Spreadsheet SupportType of Test Excel/PHStatProcedure

    One sample test for mean, unknown PHStat: One Sample Test Z-test for the

    Mean, Sigma KnownOne sample test for mean, unknown PHStat: One Sample Test t-test for the

    Mean, Sigma Unknown

    One sample test for proportion PHStat: One Sample Test Z-test for theProportion

    Two sample test for means, known Excel z-test: Two-Sample for Means

    PHStat: Two Sample Tests Z-Test forDifferences in Two Means

    Two sample test for means, unknown,unequal

    Excel t-test: Two-Sample AssumingUnequal Variances

  • 8/4/2019 SDA 3E Chapter 5

    11/62

    Hypothesis Tests and

    Spreadsheet Support (contd)Type of Test Excel/PHStatProcedure

    Two sample test for means, unknown,assumed equal

    Excel t-test: Two-Sample Assuming EqualVariances

    PHStat: Two Sample Tests t-Test forDifferences in Two Means

    Paired two sample test for means Excel t-test: Paired Two-Sample for Means

    Two sample test for proportions PHStat: Two Sample Tests Z-Test forDifferences in Two Proportions

    Equality of variances Excel F-test Two-Sample for Variances

    PHStat: Two Sample Tests F-Test forDifferences in Two Variances

  • 8/4/2019 SDA 3E Chapter 5

    12/62

    One Sample Tests for Means

    Standard Deviation Unknown Example hypothesis

    H0: 0 versus H1: < 0 Test statistic:

    Reject H0if t < -t

    n-1,

    ns

    xt

    /

    0=

  • 8/4/2019 SDA 3E Chapter 5

    13/62

    Example For the Customer Support Survey.xls data, test thehypotheses

    H0: mean response time 30 minutes H1: mean response time< 30 minutes

    Sample mean = 21.91; sample standard deviation =

    19.49; n = 44 observations

    Reject H0 because t = 2.75 < -t43,0.05 = -1.6811

  • 8/4/2019 SDA 3E Chapter 5

    14/62

    PHStatTool: t-Test for Mean PHStatmenu > One Sample

    Tests > t-Test for the Mean,

    Sigma Unknown

    Enter null hypothesis and alpha

    Enter sample statistics or datarange

    Choose type of test

  • 8/4/2019 SDA 3E Chapter 5

    15/62

    Results

  • 8/4/2019 SDA 3E Chapter 5

    16/62

  • 8/4/2019 SDA 3E Chapter 5

    17/62

    One Sample Tests for

    Proportions Example hypothesis

    H0:

    0versusH

    1:

  • 8/4/2019 SDA 3E Chapter 5

    18/62

    Example For the Customer Support Survey.xls data, test the hypothesis that the

    proportion of overall quality responses in the top two boxes is at least0.75

    H0: .75 H

    0: < .75

    Sample proportion = 0.682; n = 44

    For a level of significance of 0.05, the critical value ofzis -1.645;therefore, we cannot reject the null hypothesis

  • 8/4/2019 SDA 3E Chapter 5

    19/62

    PHStat Tool: One Sample z-

    Test for Proportions PHStat> One Sample Tests> z-Tests

    for the Proportion

    Enter null hypothesis,significance level, numberof successes, and sample

    sizeEnter type of test

  • 8/4/2019 SDA 3E Chapter 5

    20/62

    Results

  • 8/4/2019 SDA 3E Chapter 5

    21/62

    Type II Errors and the Power

    of a Test The probability of a Type II error, , and the

    power of the test (1 ) cannot be chosen by

    the experimenter. The power of the test depends on the true

    value of the population mean, the level ofconfidence used, and the sample size.

    A power curve shows (1 ) as a function of

    1.

  • 8/4/2019 SDA 3E Chapter 5

    22/62

    Example Power Curve

  • 8/4/2019 SDA 3E Chapter 5

    23/62

    Two Sample Tests for Means

    Standard Deviation Known Example hypothesis

    H0:1 20 versusH1:1 -2 < 0

    Test Statistic:

    Reject if z < -z

    2

    2

    21

    2

    1

    21

    // nn

    xxz

    +

    =

  • 8/4/2019 SDA 3E Chapter 5

    24/62

    Two Sample Tests for Means

    Sigma Unknown and Equal Example hypothesis

    H0:1 20 versusH1:1 -2 > 0

    Test Statistic:

    Reject if z > z

    21

    21

    21

    2

    22

    2

    11

    21

    2

    )1()1(

    nn

    nn

    nn

    snsn

    xxz

    +

    +

    =

  • 8/4/2019 SDA 3E Chapter 5

    25/62

    Two Sample Tests for Means

    Sigma Unknown and Unequal Example hypothesis

    H0:1 2=0 versusH1:1 -2 0

    Test Statistic:

    Reject if z > z/2 or z < - z/2

    t = (x1

    -

    x2) / 2

    2

    2

    1

    2

    1

    n

    s

    n

    s+

    +

    +

    1

    )/(

    1

    )/(

    2

    2

    2

    2

    2

    1

    2

    1

    2

    1

    2

    2

    2

    2

    1

    2

    1

    n

    ns

    n

    ns

    ns

    ns

    with df =

  • 8/4/2019 SDA 3E Chapter 5

    26/62

    Excel Data Analysis Tool: Two

    Sample t-Tests Tools> Data Analysis> t-test: Two Sample

    Assuming Unequal Variances, or t-test: TwoSample Assuming Equal Variances

    Enter range of data, hypothesized meandifference, and level of significance

    Tool allows you to test H0:

    1-

    2= d

    Output is provided for upper-tail test only For lower-tail test, change the sign on t

    Critical one-tail, and subtract P(T

  • 8/4/2019 SDA 3E Chapter 5

    27/62

    PHStatTool: Two Sample

    t-Tests PHStat> Two Sample Tests> t-Test

    for Differences in Two Means

    Test assumes equal variances Must compute and enter the sample

    mean, sample standard deviation, and

    sample size

  • 8/4/2019 SDA 3E Chapter 5

    28/62

    Comparison of Excel and PHStat

    Results Lower-Tail Test

  • 8/4/2019 SDA 3E Chapter 5

    29/62

    Two Sample Test for Means

    With Paired Samples Example hypothesis

    H0: average difference=0 versus

    H1: average difference0

    Test Statistic:

    Reject if t > tn-1,/2 or t < - tn-1,/2

    ns

    Dt

    D

    D

    /

    =

  • 8/4/2019 SDA 3E Chapter 5

    30/62

    Two Sample Tests for

    Proportions Example hypothesis

    H0: 1 2=0 versusH1: 1 -2 0

    Test Statistic:

    Reject if z > z/2 or z < - z/2

    +

    =

    21

    21

    11)1(

    nnpp

    ppz

    where21 nn

    samplesbothinsuccessesofnumberp+

    =

  • 8/4/2019 SDA 3E Chapter 5

    31/62

    Hypothesis Tests and

    Confidence Intervals If a 100(1 )% confidence interval contains

    the hypothesized value, then we would not

    reject the null hypothesis based on this valuewith a level of significance . Example hypothesis

    H0: 0 versus H1: < 0 If a 100(1-)% confidence interval does not

    contain 0, then we can reject H0

  • 8/4/2019 SDA 3E Chapter 5

    32/62

    F-Test for Differences in Two

    Variances Hypothesis

    H0: 1

    2 2

    2=0 versusH

    1: 1

    2 -22 0

    Test Statistic:

    Assume s12 > s2

    2

    Reject if F > F/2,n1-1,n2-1 (see Appendix A.4)

    Assumes both samples drawn from normaldistributions

    2

    2

    21

    s

    sF =

  • 8/4/2019 SDA 3E Chapter 5

    33/62

    Excel Data Analysis Tool: F-

    Test for Equality of Variances Tools> Data Analysis> F-test for

    Equality of Variances

    Specify data ranges Use /2 for the significance level! If the variance of Variable 1 is greater

    than the variance of variable 2, theoutput will specify the upper tail;otherwise, you obtain the lower tailinformation.

  • 8/4/2019 SDA 3E Chapter 5

    34/62

    PHStat Tool: F-Test for

    Differences in Variances PHStatmenu > Two Sample Tests> F-

    test for Differences in Two Variances

    Compute and enter sample standarddeviations

    Enter the significance level , not /2as in Excel

  • 8/4/2019 SDA 3E Chapter 5

    35/62

    Excel and PHStatResults

  • 8/4/2019 SDA 3E Chapter 5

    36/62

    Analysis of Variance (ANOVA) Compare the means of m different

    groups (factors) to determine if all are

    equal H

    0: 1 = 1 = ... m

    H1: at least one mean is different from the

    others

  • 8/4/2019 SDA 3E Chapter 5

    37/62

    ANOVA Theory nj = number of observations in sample j

    SST = total variation in the data

    SSB = variation between groups

    SSW = variation within groups

    SST = SSB + SSW

    = =

    =n

    j

    n

    i

    ij

    j

    XXSST

    1 1

    2)(

    =

    =n

    j

    jj XXnSSB1

    2)(

    = = =n

    j

    n

    i

    jij

    j

    XXSSW1 1

    2)(

  • 8/4/2019 SDA 3E Chapter 5

    38/62

    ANOVA Test Statistic MSB = SSB/(m 1)

    MSW = SSW/(n m)

    Test statistic: F = MSB/MSW Has an F-distribution with m-1 and n-m

    degrees of freedom

    Reject H0 if F > F/2,m-1,n-m

  • 8/4/2019 SDA 3E Chapter 5

    39/62

    Excel Data Analysis Tool for

    ANOVA Tools> Data Analysis>ANOVA: Single

    Factor

  • 8/4/2019 SDA 3E Chapter 5

    40/62

    ANOVA Results

  • 8/4/2019 SDA 3E Chapter 5

    41/62

    ANOVA Assumptions The mgroups or factor levels being studied

    represent populations whose outcome

    measures are Randomly and independently obtained Are normally distributed Have equal variances

    Violation of these assumptions can affect thetrue level of significance and power of thetest.

  • 8/4/2019 SDA 3E Chapter 5

    42/62

    Nonparametric Tests Used when assumptions (usually

    normality) are violated. Examples: Wilcoxon rank sum test for testing

    difference between two medians Kurskal-Wallis rank test for determining

    whether multiple populations have equalmedians. Both supported by PHStat

  • 8/4/2019 SDA 3E Chapter 5

    43/62

    Tukey-Kramer Multiple

    Comparison ProcedureANOVA cannot identify which means

    may differ from the rest

    PHStatmenu > Multiple Sample Tests> Tukey-Kramer Multiple ComparisonProcedure

    Enter Q Statistic from Table A.5

  • 8/4/2019 SDA 3E Chapter 5

    44/62

    Chi-Square Test for

    Independence Test whether two categorical variables

    are independent H0: the two categorical variables are

    independent

    H1: the two categorical variables are

    dependent

  • 8/4/2019 SDA 3E Chapter 5

    45/62

    Example Is gender independent of holding a CPA

    in an accounting firm?

  • 8/4/2019 SDA 3E Chapter 5

    46/62

    Chi-Square Test for

    Independence Test statistic

    Reject H0 if2 > 2, (r-1)(c-1) PHStattool available in Multiple Sample

    Testsmenu

    e

    eo

    f

    ff 22 )( =

    where f0= observed frequency

    fe= expected frequency if H0 true

    in the cells of the contingency table

  • 8/4/2019 SDA 3E Chapter 5

    47/62

    ExampleExpected No CPA CPA Total

    Female 6.74 7.26 14

    Male 6.26 6.74 13Total 13 14 27

    Critical value with = 0.05 and (2 - 1)(2 - 1) - 1 df =3.841; therefore, we cannot reject the null hypothesisthat the two categorical variables are independent.

  • 8/4/2019 SDA 3E Chapter 5

    48/62

    PHStat Procedure Results

  • 8/4/2019 SDA 3E Chapter 5

    49/62

    Design of ExperimentsA test or series of tests that enables the

    experimenter to compare two or more

    methods to determine which is better,or determine levels of controllablefactors to optimize the yield of a

    process or minimize the variability of aresponse variable.

  • 8/4/2019 SDA 3E Chapter 5

    50/62

    Factorial Experiments All combinations of levels of each factor are considered.

    With m factors at k levels, there are km experiments. Example: Suppose that temperature and reaction time

    are thought to be important factors in the percent yield ofa chemical process. Currently, the process operates at atemperature of 100 degrees and a 60 minute reactiontime. In an effort to reduce costs and improve yield, theplant manager wants to determine if changing the

    temperature and reaction time will have any significanteffect on the percent yield, and if so, to identify the bestlevels of these factors to optimize the yield.

  • 8/4/2019 SDA 3E Chapter 5

    51/62

    Designed ExperimentAnalyze the effect of two levels of each

    factor (for instance, temperature at 100

    and 125 degrees, and time at 60 and90 minutes)

    The different combinations of levels of

    each factor are commonly calledtreatments.

  • 8/4/2019 SDA 3E Chapter 5

    52/62

    Treatment Combinations

    Low

    High

    Low High

  • 8/4/2019 SDA 3E Chapter 5

    53/62

    Experimental Results

  • 8/4/2019 SDA 3E Chapter 5

    54/62

    Main Effects Measures the difference in the response that

    results from different factor levels Calculations

    Temperature effect = (Average yield at high level) (Average yieldat low level)

    = (B + D)/2 (A + C)/2

    = (90.5 + 81)/2 (84 + 88.5)/2

    = 85.75 86.25 = 0.5 percent. Reaction effect = (Average yield at high level) (Average yield at

    low level)

    = (C + D)/2 (A + B)/2

    = (88.5 + 81)/2 (84 + 90.5)/2

    = 84.75 87.25 = 2.5 percent.

  • 8/4/2019 SDA 3E Chapter 5

    55/62

    Interactions When the effect of changing one factor

    dependson the level of other factors.

    When interactions are present, wecannotestimate response changes bysimply adding main effects; the effect

    of one factor must be interpretedrelative to levels of the other factor.

  • 8/4/2019 SDA 3E Chapter 5

    56/62

    Interaction Calculations Take the average difference in response

    when the factors are both at the high or lowlevels and subtracting the average difference

    in response when the factors are at oppositelevels. Temperature Time Interaction

    = (Average yield, both factors at same level)

    (Average yield, both factors at opposite levels)= (A + D)/2 (B + C)/2

    = (84 + 81)/2 (90.5 + 88.5)/2 = -7.0 percent

  • 8/4/2019 SDA 3E Chapter 5

    57/62

    Graphical Illustration ofInteractions

  • 8/4/2019 SDA 3E Chapter 5

    58/62

    Two-Way ANOVA

    Method for analyzing variation in a 2-factorexperiment

    SST = SSA + SSB + SSAB + SSWwhere

    SST = total sum of squares

    SSA = sum of squares due to factor A

    SSB = sum of squares due to factor B

    SSAB = sum of squares due to interaction

    SSW = sum of squares due to random variation (error)

  • 8/4/2019 SDA 3E Chapter 5

    59/62

    Mean Squares

    MSA = SSA/(r 1)

    MSB = SSB/(c 1)

    MSAB = SSAB/(r-1)(c-1)

    MSW = SSW/rc(k-1),

    where k = number of replications ofeach treatment combination.

  • 8/4/2019 SDA 3E Chapter 5

    60/62

    Hypothesis Tests

    Compute F statistics by dividing each mean squareby MSW. F = MSA/MSW tests the null hypothesis that means for

    each treatment level of factor A are the same against thealternative hypothesis that not all means are equal.

    F = MSB/MSW tests the null hypothesis that means foreach treatment level of factor A are the same against the

    alternative hypothesis that not all means are equal. F = MSAB/MSW tests the null hypothesis that the

    interaction between factors A and B is zero against thealternative hypothesis that the interaction is not zero.

  • 8/4/2019 SDA 3E Chapter 5

    61/62

    ExcelAnova: Two-Factor withReplication

  • 8/4/2019 SDA 3E Chapter 5

    62/62

    Results

    Examine p-values forsignificance