Stats Lecture 08 Hypothesis Testing

Embed Size (px)

Citation preview

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    1/32

    Tests of Hypothesis

    For Means and Proportions

    Quantitative Methods for Economics

    Dr. Katherine Sauer

    Metropolitan State College of Denver

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    2/32

    Chapter Overview:

    I. Hypothesis Tests for Means

    II. Type I and Type II ErrorsII. Hypothesis Tests for Proportions

    IV. Hypothesis Test for Difference in Means

    V. Hypothesis Test for Difference in Proportions

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    3/32

    I. Hypothesis Tests for Means

    A null hypothesis is a claim about a population characteristic.

    H0

    Ex: A property developer makes a claim that the average annual

    rental income per student is at most $5000.

    H0: < 5000

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    4/32

    If the null hypothesis is rejected, then the alternative hypothesis

    prevails.

    The alternative hypothesis is the complement of the null.

    H1 HA

    Ex: If H0: < 5000, then H1: > 5000

    The null hypothesis is usually a statement about the status quo

    and its expression always contains the equality.

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    5/32

    Ex: A property developer claims the average rental income per

    room in student housing is at most $5000 for the year. A sample of36 students is randomly selected. The mean annual rent is

    calculated to be $5200 from this sample. The standard deviation for

    all rents is $735.

    1. State the null and alternative hypothesis.H0: < 5000

    H1: > 5000

    Because the alternative hypothesis only refers tovalues greater than 5000, well use a one-sided test

    (upper tail).

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    6/32

    2. Decide at what level of probability the null hypothesis will be

    rejected.

    - the null hypothesis will be rejected if the p-value is less

    than a given probability- usually 0.05 or 0.01

    For this example, lets use = 0.05.

    3. Sketch the curve and identify the critical region.

    for = 0.05 Z0.05 = 1.6449

    = 5000

    Z = 1.6449

    Reject

    H0

    Accept H0 Accept H0 if Z 1.6449

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    7/32

    x

    H

    x

    xZ

    0

    nx

    4. Calculate Z:

    5.12236

    735

    nx

    63.1

    5.122

    50005200

    xZ

    = 5000

    Z = 1.6449

    Reject

    H0

    Accept H0

    Z = 1.63

    Accept H0 because

    1.63

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    8/32

    5. Calculate the p-value.

    The p-value is the area under the curve and to the right of our

    sample Z.

    look up 1.63 in the table

    p-value = 0.0516

    = 5000

    Z = 1.6449

    Reject

    H0

    Accept H0

    Z = 1.63

    Close to 0.05, but not

    close enough.

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    9/32

    Ex: A property developer claims the average rental income per

    room in student housing is at least $5000 for the year. A sample of36 students is randomly selected. The mean annual rent is

    calculated to be $5200 from this sample. The standard deviation for

    all rents is $735. Use = 0.05

    1. State the null and alternative hypothesis.H0: > 5000

    H1: < 5000

    Because the alternative hypothesis only refers tovalues less than 5000, well use a one-sided test

    (lower tail).

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    10/32

    2. Sketch the curve and identify the critical region.

    for = 0.05 Z0.05 = -1.6449

    = 5000

    Z = -1.6449

    Reject

    H0

    Accept H0 Accept H0 if Z >-1.6449

    Reject H0 if Z < -1.6449

    x

    H

    x

    x

    Z

    0

    nx

    3. Calculate Z:

    5.12236

    735

    nx

    63.1

    5.122

    50005200

    xZ

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    11/32

    = 5000

    Z = -1.6449

    Z = 1.63

    Accept H0 because

    1.63 > -1.6449.

    Reject

    H0

    Accept H0

    4. Calculate the p-value.

    The p-value is the area under the curve and to the leftof our

    sample Z.look up 1.63 in the table

    0.0516

    10.0516 = 0.9484

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    12/32

    Comparing the two scenarios:

    H0: < 5000H1: > 5000

    Accept the null hypothesis that the true mean is less than

    or equal to $5000 with a p-value of 0.0516.

    H0: > 5000

    H1: < 5000

    Accept the null hypothesis that the true mean is greater

    than or equal to $5000 with a p-value of 0.9485.

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    13/32

    Ex: A property developer claims the average rental income per

    room in student housing is $5000 for the year. A sample of 36

    students is randomly selected. The mean annual rent is calculated tobe $5200 from this sample. The standard deviation for all rents is

    $735. Use = 0.05

    1. State the null and alternative hypothesis.H0: = 5000

    H1: 5000

    Because the alternative hypothesis refers to all

    values other than 5000, well use a two-sided test.

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    14/32

    2. Sketch the curve and identify the critical region.

    for = 0.05 /2 = 0.025 Z0.025 = 1.96

    = 5000

    Z = -1.96

    Reject

    H0

    Accept H0 Accept H0 if

    -1.96 < Z < 1.96

    Reject H0 ifZ < -1.96 or Z > 1.96

    Z = 1.96

    Reject

    H0

    x

    Hx xZ

    0

    n

    x 3. Calculate Z:

    5.12236

    735

    nx

    63.1

    5.122

    50005200

    xZ

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    15/32

    = 5000

    Z = -1.96

    Reject

    H0

    Accept H0

    Z = 1.96

    Reject

    H0

    Z = 1.63

    Accept H0 because-1.96 < 1.63 < 1.96

    4. Calculate the p-value.

    The p-value is the area under the curve and to the leftof -1.63

    and the area under the curve to the rightof 1.63.

    look up 1.63 in the table

    0.0516

    p-value = 0.0516 + 0.0516

    p-value = 0.1032

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    16/32

    The Relationship between Confidence Intervals

    and Hypothesis Testing

    Same example: Lets calculate the 95% confidence interval.

    xZx 2/

    5200 + 1.96(122.5)5200 + 240.1

    4959.9 to 5440.1

    We are 95% sure that the population mean is between $4959.9

    and $5440.1.

    Since the claim is = 5000, our CI supports the claim.

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    17/32

    A two-sided Confidence Interval is a set of acceptable two-

    sided null hypotheses at the same level of significance.(same argument for one-sided CIs and hypotheses)

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    18/32

    II. Type I and Type II errors

    If a sample mean falls in the acceptance region, we say

    there is no significant difference between the

    sample mean and the hypothesized population mean.

    If the sample mean falls in the rejection region, we say

    there is a significant difference between the sample

    mean and the hypothesized population mean.

    - the difference is too great to attribute to chance

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    19/32

    If you reject the null when it is actually true, it is called a Type I

    error.

    is the probability of committing a Type I error.

    If you reject the alternative hypothesis when it is actually true, it is

    called a Type II error.

    is the probability of committing a Type II error.

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    20/32

    Thepower of a testis the probability of accepting a true

    alternative hypothesis.

    The power of a test is also defined as the probability of rejectinga false null hypothesis.

    The power of a test increases as increases.

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    21/32

    III. Hypothesis tests for Proportions

    Ex: A Budget airline claims that 96% of its flights depart on time. A

    researcher working for the company records departure informationfor 80 randomly selected flights and finds that 5 departed late. Test

    the airlines claim at the 1% significance level.

    1. State the null and alternative hypothesesp = 5/80 = 0.0625 departed late

    = 0.96 depart on time so = 0.04 departed late

    H0: = 0.04

    H1: 0.04

    (2-sided test)

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    22/32

    2. Sketch the curve and identify the critical region.

    for = 0.01 /2 = 0.005 Z0.005 = 2.5758

    =0.04

    Z = -2.5758

    Reject

    H0

    Accept H0 Accept H0 if

    -2.5758 < Z < 2.5758

    Reject H0 ifZ < -2.5758 or Z > 2.5758

    Z = 2.5758

    Reject

    H0

    3. Calculate Z:

    0274.10219.0

    04.00625.0

    pZ

    p

    p

    p

    Z

    nsp

    )1(

    0219.080

    )04.01(04.0

    ps

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    23/32

    =0.04

    Z = -2.5758

    Reject

    H0

    Accept H0

    Z = 2.5758

    Reject

    H0

    Z = 1.0274

    Accept H0 because-2.5758

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    24/32

    Alternative:

    | p | = | 0.040.0625| = 0.0225

    0.04 + 0.0225 = 0.0625

    0.040.0225 = 0.0175

    p-value = pr( p > 0.0625) + pr( p < 0.0175)

    0.0625 = x / 80 x = 5

    0.0175 = x / 80 x = 1.4

    If the true percentage of late departures is 4%, there is a 30%

    chance of selecting 5 or more late departures or 1.4 or fewer

    departures in 80.

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    25/32

    IV. Hypothesis Test for Difference in Means

    Ex: A group of students and a group of young professionals are

    asked about their yearly rent expenditures.

    Is there a difference in the average rental expenditure betweenthe two groups? (5% significance level)

    1. State the null and alternative hypotheses

    H0: A = B sometimes written as A - B = 0H1: A B(2-sided test)

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    26/32

    2. Sketch the curve and identify the critical region.

    for = 0.05 /2 = 0.025 Z0.025 = 1.96

    A - B = 0

    Z = -1.96

    Reject

    H0

    Accept H0 Accept H0 if

    -1.96 < Z < 1.96

    Reject H0 ifZ < -1.96 or Z > 1.96

    Z = 1.96

    Reject

    H0

    3. Calculate Z:

    2046.20089.127

    )0()49205200(

    BxAxZ

    BxAx

    BABA

    BxAxs

    xx

    Z

    )()(

    B

    B

    A

    ABxAxn

    s

    n

    ss

    22

    0089.12745

    )225(

    36

    )735(22

    BxAxs

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    27/32

    =0.04

    Z = -2.5758

    Reject

    H0

    Accept H0

    Z = 2.5758

    Reject

    H0

    Z = 2.2046

    Accept H0 because-2.57582.20) + pr(Z< -2.20)

    = 0.0139 + 0.0139

    = 0.0278

    There is a 2.78% chance that 2 sample means will differ by

    52004920 = 280 or more when the population means

    are equal

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    28/32

    V. Hypothesis Test for Difference in Proportions

    When testing whether or not two population proportions are

    different, combine the two sample proportions into a pool.

    pc = # items with given characteristic in both samples

    sum of all items in both samples

    BA

    cccombinedpBpAnn

    ppss11

    )1(

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    29/32

    Ex: Test the hypothesis that the support for the Green Party is thesame in both areas. Use 10% significance.

    1. State the null and alternative hypotheses

    H0: A = B

    H1: A B

    Calculate pc 88+54 = 142 =0.3944

    200+160 360

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    30/32

    2. Sketch the curve and identify the critical region.

    for = 0.10 /2 = 0.05 Z0.005 = 1.6449

    A - B = 0

    Z = -1.6449

    Reject

    H0

    Accept H0 Accept H0 if

    -1.6449 < Z < 1.6449

    Reject H0 ifZ < -1.6449 or Z > 1.6449

    Z = 1.6449

    Reject

    H0

    3. Calculate Z: pBpA

    BABA

    pBpA s

    pp

    Z

    )()(

    BA

    ccpBpAnnpps11

    )1(

    0518.0160

    1

    200

    1)3944.01(3944.0

    pBpAs 9788.1

    0518.0

    )0()3375.044.0(

    pBpAZ

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    31/32

    Z = -1.6449

    Reject

    H0

    Accept H0

    Z = 1.6449

    Reject

    H0

    Z = 1.98

    Reject H0 because1.98>1.6449

    4. p-value

    p-value = pr(Z>1.98) + pr(Z< -1.98)

    = 0.0239 + 0.0239

    = 0.0478

    When the null hypothesis is rejected, the p-value is the level of

    significance.

    A - B = 0

  • 8/3/2019 Stats Lecture 08 Hypothesis Testing

    32/32

    Concepts:

    Type I, Type II errors

    Power of a test

    Skills:Perform Hypothesis Tests for means, proportions, differences in

    means, differences in proportions