Chapter 7 L2

Embed Size (px)

Citation preview

  • 8/11/2019 Chapter 7 L2

    1/33

    Chapter 7

    Hypothesis Testing Two

    PopulationsWeek 10

    L3: - Hypothesis Testing Between two means

    (2 populations, variance unknown but not equal)- Hypothesis Testing Between two means(2 populations, variance unknown large samples)

    - Hypothesis Testing- proportion

    ( 2 populations) 1September 2013

  • 8/11/2019 Chapter 7 L2

    2/33

    Learning Objectives

    At the end of the lesson student should beable to

    Carry out hypothesis testing fordifference in means for two normalpopulations ( variances unknown)

    Carry out hypothesis testing for

    difference in means for difference in twoproportion

    2September 2013

  • 8/11/2019 Chapter 7 L2

    3/33

    Null Hypothesis is the same as before:

    TWO V RI NCES RE UNKNOWN ND UNEQU L

    Test about the difference

    Test statistic:

    )/()/(

    )()(

    2

    2

    21

    2

    1

    2121

    nSnS

    xx

    T

    Case 2:2

    2

    2

    1

    But the degree of freedom is given by

    1

    )/(

    1

    )/(

    )(

    2

    2

    2

    2

    2

    1

    2

    1

    2

    1

    2

    2

    2

    2

    1

    2

    1

    n

    ns

    n

    ns

    n

    s

    n

    s

    If is not an integer, round down to the nearest integer.

    021

    3

  • 8/11/2019 Chapter 7 L2

    4/33

    Test about the difference

    Case 2:2

    2

    2

    1

    021

    Critical region:

    Alternative Hypothesis Rejection Criteria ( Reject H0)

    TEST BOUT TWO NORM L ME NS

    WHEN TWO V RI NCES RE UNKNOWN

    vv tTortT ,2/,2/ 211: H

    vtT ,211: H

    vtT ,211: H

    4September 2013

  • 8/11/2019 Chapter 7 L2

    5/33

    A two sided confidence interval for

    when variance is unknown :

    )%1(100 21

    2

    2

    2

    1

    2

    1,2/21

    21

    2

    22

    1

    21

    ,2/21

    n

    s

    n

    stxx

    n

    s

    n

    stxx

    Confidence interval:

    Case 2: 22

    2

    1

    Value of is from the formula earlier5

    September 2013

  • 8/11/2019 Chapter 7 L2

    6/33

    6

    Example 1:

    Two companies manufacture a rubber material intended for use in

    an automotive application. 25 samples of material from each

    company are tested, and the amount of wear after 1000 cycles are

    observed. For company 1, the sample mean and standard deviation

    of wear are

    and for company 2, we obtain

    cycles1000/9.1andcycles1000/12.20 11 mgsmgx

    Do the sample data support the claim that the two companiesproduce material with different mean wear? Assume each population

    is normally distributed but unequal variances?

    cycles1000/9.7andcycles1000/64.11 22 mgsmgx

    September 2013

  • 8/11/2019 Chapter 7 L2

    7/33

    7

    2. State the null hypothesis H0 and appropriate alternative

    hypothesis, H1

    0: 210 H 0: 211 H

    3. Determine the appropriate test statistic

    )/()/(

    )()(

    2

    2

    21

    2

    1

    2121

    nSnS

    xxT

    1. Identify the parameter of interest

    Parameter of interest; the difference between the true average

    Variances unknown and unequal21

    September 2013

  • 8/11/2019 Chapter 7 L2

    8/33

    8

    5. State the rejection region for the statistic

    479.2ifHjectRe 0 T

    4. Critical value given 0.01 479.226,01.0, tt v

    2 22 2 2 2

    1 2

    1 2

    2 2 2 22 22 2

    1 2

    1 2

    1 2

    (1.9) (7.9)

    25 2526.77

    (1.9) (7.9)

    25 25

    24 241 1

    26

    s s

    n n

    s s

    n n

    n n

    September 2013

  • 8/11/2019 Chapter 7 L2

    9/33

    9

    7. Make a decision

    Decision: since we reject H0

    Enough evidence to support that

    479.222.5 T

    21

    6. Compute the value of the test statistic

    22.5

    25

    )9.7(

    25

    )9.1(

    0)64.1112.20(

    22

    T

    September 2013

  • 8/11/2019 Chapter 7 L2

    10/33

    10

    Exercise:

    The following data represent the running times of films produced

    by 2 motion-picture companies. Test the hypothesis that theaverage running time of films produced by company 2 exceeds the

    average running time of films produced by company 1 by 10

    minutes against the one-sided alternative that the difference is less

    than 10 minutes? Use 0.01 and assume the distributions of

    times to be approximately normal with unequal variances.

    Time

    Company

    X1 102 86 98 109 92

    X2 81 165 97 134 92 87 114

    September 2013

  • 8/11/2019 Chapter 7 L2

    11/33

    11

    2. State the null hypothesis H0 and appropriate alternative

    hypothesis, H1

    10: 120 H 10: 121 H

    3. Determine the appropriate test statistic

    )/()/(

    )()(

    2

    2

    21

    2

    1

    1212

    nSnS

    xxT

    1. Identify the parameter of interest

    Parameter of interest; the difference between the true averageVariances unknown and unequal

    12

    September 2013

  • 8/11/2019 Chapter 7 L2

    12/33

    12

    5. State the rejection region for the statistic

    998.2ifHjectRe 0 T

    4. Critical value given 0.01 998.27,01.0, tt v

    38.76/)7/333.913(4/)5/8.78(

    )7/333.9135/8.78(

    1

    )/(

    1

    )/(

    )(

    22

    2

    2

    2

    2

    2

    2

    1

    2

    1

    2

    1

    2

    2

    2

    2

    1

    2

    1

    n

    ns

    n

    ns

    n

    s

    n

    s

    September 2013

  • 8/11/2019 Chapter 7 L2

    13/33

    13

    7. Make a decision

    Decision: since , we fail to reject H0

    Not enough evidence that

    998.222.0 T

    1012

    22.07/333.9135/8.78

    10)4.97110(

    )/()/(

    )()(

    2

    2

    21

    2

    1

    1212

    nSnS

    xxT

    6. Compute the value of the test statistic

    September 2013

  • 8/11/2019 Chapter 7 L2

    14/33

    Test statistic:

    Test about the difference between two means (Large Samples)

    0

    2

    2

    2

    1

    2

    1

    2121 Hunder)1,0(~)()(

    N

    n

    S

    n

    S

    xxZ

    Null Hypothesis:

    vs210: H 211211211 :or:or,: HHH

    Alternative Hypothesis Rejection Criteria ( Reject H0)

    211: H

    211: H

    211: H

    2/2/ zZorzZ

    zZ

    zZ

    Case 3:

  • 8/11/2019 Chapter 7 L2

    15/33

    A confidence interval for is)%1(100 21

    2

    2

    2

    1

    2

    1

    2/2121

    2

    2

    2

    1

    2

    1

    2/21

    n

    S

    n

    Szxx

    n

    S

    n

    Szxx

    The procedures used in hypothesis testing for 2 populationsare the same as in the hypothesis testing for one population.

    Conclusion of the test could also be based on the confidence

    Interval and the p-value.

    September 2013

  • 8/11/2019 Chapter 7 L2

    16/33

    Example 3:

    A study wants to investigate if the mean price of a new Proton car has

    changed in 2012 compared to 2011. A sample of cars were taken duringthese two years and summary information as given below:

    i. Perform the test for the above investigation. What is your conclusion?

    ii. Find the two sided 95% CI for the difference between the two means in

    2011 and 2012. What is your conclusion comparing with part (i).

    Year 2011 2012

    Mean car price RM 45,000 RM 48,000

    Standard deviation of car

    prices

    RM 1,500 RM 2,000

    Number of cars 150 200

    September 2013

  • 8/11/2019 Chapter 7 L2

    17/33

    Solution

    1. From the problem context, identify the parameter of interest

    21

    2. State the null hypothesis H0 and appropriate alternative

    hypothesis, H1

    210 : H 211: H

    3. Determine the appropriate test statistic

    )/()/(

    )()(

    2

    2

    21

    2

    1

    2121

    nSnS

    xxZ

    To test the difference between the true average large sample

    September 2013

  • 8/11/2019 Chapter 7 L2

    18/33

    6. Compute any necessary sample quantities, substitute these into

    the equation for the test statistic, and compute the value

    ,200,150,2000,1500,000,48,45000212121

    nnSSXX

    Compute the value of the test statistic:

    04.16

    )200/2000()150/1500(000,48000,45

    )/()/()()(

    22

    2

    2

    21

    2

    1

    2121

    nSnS

    xxZ

    Find the p - value

    P-value = 0)11(2))04.16(1(2 Since p-value < 0.05, we reject the null hypothesis. We conclude that the mean price

    of car in 2012 has change significantly compared to 2011.

  • 8/11/2019 Chapter 7 L2

    19/33

    From formula:

    2

    2

    2

    1

    2

    1

    2/2121

    2

    2

    2

    1

    2

    1

    2/21)()()(

    n

    S

    n

    Szxx

    n

    S

    n

    Szxx

    Find a 95% CI on the difference in means.

    200

    2000150

    150096.14800045000200

    2000150

    150096.1480004500022

    21

    22

    32.263367.336621

    Since 1 2 0is not in the interval then we reject H0.

    Both propellants are not the same mean burning rate.

    September 2013

  • 8/11/2019 Chapter 7 L2

    20/33

    Exercise:

    In a test to compare the effectiveness of two drugs designed

    to lower cholesterol levels, 75 randomly selected patientswere given drug A and 100 randomly selected patients were

    given drug B. Those given drug A reduced their cholesterol

    levels by an average of 40mg with standard deviation 12mg,

    and those given drug B reduced their cholesterol levels by anaverage 42mg with standard deviation of 15mg.

    i. Perform the test for the above investigation. Can you

    conclude that the mean reduction using drug B is greater

    than that of drug A?ii. Find the two sided 95% CI for the difference between the

    two means of reductions using drug A and drug B. What is

    your conclusion comparing with part (i).

    September 2013

  • 8/11/2019 Chapter 7 L2

    21/33

    TEST FOR TWO PROPORTIONS

    Alternative Hypothesis Rejection Criteria ( Reject H0)

    Null Hypothesis:210: ppH ):,:(or 210210 ppHppH

    2/2/ zZorzZ 211: ppH

    zZ211: ppH

    211: ppH zZ

    Test Problems about two proportions:

    Test statistic:

    21

    21

    21

    2

    22

    1

    11

    n1

    n1

    21

    ppwhen)1,0(NZ

    nn

    XXp,

    n

    Xp,

    n

    Xp;

    ))(p1(p

    ppZ

    21

    21

  • 8/11/2019 Chapter 7 L2

    22/33

    A two sided confidence interval for is:)%1(100 21 pp

    ULppLL

    n

    pp

    n

    ppzppUL

    n

    pp

    n

    ppzppLL

    21

    2

    22

    1

    112/21

    2

    22

    1

    112/21

    )1()1()(

    )1()1()(

    Confidence interval:

    22September 2013

    E l 4

  • 8/11/2019 Chapter 7 L2

    23/33

    23

    Solution

    Step 1 Problem: Test about two proportions large samples

    Step 2 H0: pA= pB H1: pA> pB

    Example 4:In a study on the effects of sodium restricted diets on hypertension, 24

    out of 55 hypertensive patients were on sodium restricted diets, and 36

    out of 149 non-hypertensive patients were on sodium restricted diets.

    i. Test the hypothesis that the proportion of patients on sodium

    restricted diets is higher for hypertensive patients at a=0.05.

    ii. What is the P-value for this test?

    iii. Construct a two sided 95% CI and comment.

    Step 3 Determine the appropriate test statistic

    BA

    BA

    B

    B

    B

    A

    A

    A

    BA

    BA

    BA

    nn

    XXp,

    n

    Xp,

    n

    Xpwhere

    ppifN(0,1)))(p(1p

    ppZ

    n1

    n1

  • 8/11/2019 Chapter 7 L2

    24/33

    24

    Step 4 Critical value given 0.05 z= z 0.05 = 1.645

    645.1jectRe 0 ZifH

    Step 5 Rejection region for the statistic

    Step 6 Compute the value of the test statistic:

    29.014955

    3624

    where,9455.4

    149

    1

    55

    1)30.01(30.0

    24.044.0

    24.0,44.0,36,24,149,55

    0

    pz

    ppxxnn BABABA

    September 2013

  • 8/11/2019 Chapter 7 L2

    25/33

    25

    Step 7.Make a decision

    Since z0> 1.65, then we reject H0. It means that enough

    evidence to claim that the proportion of patients on

    hypertension is higher than non hypertension patients

    September 2013

    Example 5:

  • 8/11/2019 Chapter 7 L2

    26/33

    26

    Solution

    Step 1 Problem: Test about two proportions large samples

    Step 2 H0: p1= p2 H1: p1> p2

    Example 5:

    A vote is to be taken among residents of a town and the

    surrounding county to determine whether a proposed chemical

    plant should be constructed. If 120 of 200 town voters favour the

    proposal and 240 of 500 county residents favour it, would youagree that the proportion of town voters favouring the proposal is

    higher than the proportion of county voters? Use 0.05

    Step 3 Determine the appropriate test statistic

    21

    21

    2

    22

    1

    11

    21

    n1

    n1

    21

    nn

    XXp,

    n

    Xp,

    n

    Xpwhere

    ppifN(0,1)))(p(1p

    ppZ

    21

  • 8/11/2019 Chapter 7 L2

    27/33

    27

    Step 4 Critical value given 0.05 z = z 0.05 = 1.645

    645.1jectRe 0 ZifH

    Step 5 Rejection region for the statistic

    Step 6 Compute the value of the test statistic:

    500,200,240,120 2121 nnXX

    21

    21

    2

    22

    1

    11

    21

    n1

    n1

    21

    nn

    XXp,

    n

    Xp,

    n

    Xpwhere

    ppifN(0,1)))(p(1p

    ppZ

    21

    2.9

    500200

    240120,

    500

    240,

    200

    120 21

    Z

    ppp

    September 2013

  • 8/11/2019 Chapter 7 L2

    28/33

    28

    Step 7.Make a decision

    Decision: since , we reject H0 and agree

    that the proportion of town voters favouring the

    proposal is higher than the proportion of county voters.

    645.19.2 Z

    September 2013

  • 8/11/2019 Chapter 7 L2

    29/33

    TEST FOR TWO V RI NCES

    Alternative Hypothesis Rejection Criteria ( Reject H0)

    ):

    or,:or:vs:

    2

    2

    2

    11

    2

    2

    2

    11

    2

    2

    2

    11

    2

    2

    2

    10

    H

    HHH

    2

    2

    2

    11: H

    2

    2

    2

    11: H

    2

    2

    2

    11: H

    Test Problems about two variances:

    Test statistic:

    29

    2

    2

    2

    10

    s

    s

    F

    1,1,2/101,1,2/0 2121or

    nnnn fFfF

    1,1,0 21 nnfF

    1,1,0 21 nnfF

    September 2013

  • 8/11/2019 Chapter 7 L2

    30/33

    A two sided confidence interval for is:)%1(100 2

    2

    2

    1

    Confidence interval:

    30

    1,1,2/22

    2

    1

    22

    2

    1

    1,1,2/122

    2

    1

    1212

    nnnn fs

    s

    fs

    s

    September 2013

    Example 6:

  • 8/11/2019 Chapter 7 L2

    31/33

    31

    Solution

    Step 1 Problem: Test about two population variances

    Step 2

    Example 6:A random sample of 12 air pollution index at UTP station produced a

    variance 0.0340 while a random sample of another 13 air pollution index

    at Tronoh station produced a variance 0.0525.

    i. Are the population variances equal?. Use a = 0.05.

    ii. Find the 95% two-sided confidence interval on the ratio of two

    variances.

    Step 3 Determine the appropriate test statistic

    2

    2

    2

    11

    2

    2

    2

    10 :vs: HH

    2

    2

    21

    0s

    sF

    September 2013

  • 8/11/2019 Chapter 7 L2

    32/33

    32

    Step 4 Critical value a=0.05, fa/2, 12,13 = 3.15

    Step 5 Rejection region: Reject IF

    Step 6 Compute the value of the test statistic:

    32.015.3

    11or15.3

    13,12,025.0

    13,12,975.0013,12,025.00 f

    fFfF

    0H

    648.00525.0

    0340.02

    2

    2

    10

    s

    sF

    Step 7.Make a decision

    Since 0.32

  • 8/11/2019 Chapter 7 L2

    33/33

    A 95% two sided confidence interval for is:222

    1

    Confidence interval:

    33

    041.2206.0

    )15.3(0525.0

    0340.0

    15.3

    1

    0525.0

    0340.0

    1

    2

    2

    2

    1

    2

    2

    2

    1

    1,1,2/2

    2

    2

    12

    2

    2

    1

    1,1,2/

    2

    2

    2

    1

    1,1,2/2

    2

    2

    1

    2

    2

    2

    11,1,2/12

    2

    2

    1

    12

    12

    1212

    nn

    nn

    nnnn

    fss

    fss

    fs

    sf

    s

    s

    September 2013