45-733 PROBABILITY AND STATISTICS I Topic #8B


29 February 2000 and 2 March 2000



Hypothesis Testing (Cont.)

  1. The "intuitive" decision rule that is used in Topic #8A can be given a solid mathematical basis by appealing to the Neyman-Pearson Theorem. In particular, consider the following ratio of likelihood functions corresponding to the two hypotheses in (1):

          f(x1 , x2 , ... , xn | m = mo)
          ----------------------------- = K
          f(x1 , x2 , ... , xn | m = m1)
                                 _
    Clearly, as the sample mean, Xn, gets close to mo, 
                           _
    K > 1.  Conversely, as Xn, gets close to m1, K < 1
    and K may get quite small in magnitude.  Hence, we could 
    set up a hypothesis test using the Likelihood Ratio 
    in the same spirit as our "intuitive" test.  Namely:
    
          f(x1 , x2 , ... , xn | m = mo)
      If  ----------------------------- < K* Then Reject H0:
          f(x1 , x2 , ... , xn | m = m1)
    
          f(x1 , x2 , ... , xn | m = mo)
      If  ----------------------------- > K* Then Do Not Reject H0:
          f(x1 , x2 , ... , xn | m = m1)
    
    The Neyman-Pearson Theorem tells us that this test -- which is equivalent to our "intuitive" test -- is the best possible test. Namely:

  2. Neyman-Pearson Theorem

    Given the following hypothesis test:

    If c0f(x1 , x2 , ... , xn | m = mo) > c1f(x1 , x2 , ... , xn | m = m1) Then Do Not Reject H0:
    If c0f(x1 , x2 , ... , xn | m = mo) < c1f(x1 , x2 , ... , xn | m = m1) Then Reject H0:

    Then this test minimizes c0 a + c1 b where c0 > 0 and c1 > 0.
  3. All of the hypothesis tests that we will use are the best possible in the sense that they minimize the linear combination of the a and b errors. Note that this test can be written as:
          f(x1 , x2 , ... , xn | m = mo)    c1
      If  ------------------------------ < --- Then Reject H0:
          f(x1 , x2 , ... , xn | m = m1)    c2
    
          f(x1 , x2 , ... , xn | m = mo)    c1
      If  ----------------------------- > --- Then Do Not Reject H0:
          f(x1 , x2 , ... , xn | m = m1)    c2
    
    If c0 is the cost of making the a or Type I error, and c1 is the cost of making the b or Type II error, then this decision rule reflects the relative costs of the errors. For example, in disease testing, the cost of the a error is huge (telling a patient with tuberculosis that he/she is not sick) compared to the b error. With respect to our "intuitive" decision rule:
       _
    If Xn > m0 + c then Reject H0:
    
    this assymetry of cost has the effect of moving the decision point mo + c to the right in order to make a very small.

  4. The Hypothesis Test for a Mean of a Normal Distribution against all possible alternative values (s2 is known) is:

                 H0: m = m0
                 H1: m ¹ m0


         The decision rule for this problem is:

       _              _
    If Xn > m0 + c or Xn < m0 - c then Reject H0:
                 _
    If m0 - c  < Xn < m0 + c then Do Not Reject H0:
    
    Which is equivalent to:

        _                        _
    If (Xn - m0)/s/n1/2 > za/2 or (Xn - m0)/s/n1/2 < -za/2 then Reject H0:
                 _
    If  -za/2 < (Xn - m0)/s/n1/2 < za/2 then Do Not Reject H0:
    
  5. Example:

                 H0: m = 100
                 H1: m ¹ 100


         Where s2 = 400, n = 25, a = .05, a/2 = .025, and z.025 = 1.96

            _                  _
    Hence: (Xn - 100)/20/5  = (Xn - 100)/4
                   _                      _
    Therefore, If (Xn - 100)/4 > 1.96 or (Xn - 100)/4 < -1.96 Then Reject H0:
    
  6. The Hypothesis Test for a Mean of a Normal Distribution against all possible alternative values where s2 is unknown and a large sample (n > 30) is:

                 H0: m = m0
                 H1: m ¹ m0


         The decision rule for this problem is:

        _                        _
    If (Xn - m0)/s/n1/2 > za/2 or (Xn - m0)/s/n1/2 < -za/2 then Reject H0:
                 _
    If  -za/2 < (Xn - m0)/s/n1/2 < za/2 then Do Not Reject H0:
    
  7. The Hypothesis Test for a Mean of a Normal Distribution against all possible alternative values where s2 is unknown and a small sample (n < 30) is:

                 H0: m = m0
                 H1: m ¹ m0


    The decision rule for this problem is:

        _                        _
    If (Xn - m0)/s/n1/2 > ta/2 or (Xn - m0)/s/n1/2 < -ta/2 then Reject H0:
                 _
    If  -ta/2 < (Xn - m0)/s/n1/2 < ta/2 then Do Not Reject H0:
    
  8. Problem 10.6 p.423. Perform the following hypothesis test:

    H0: "The average hourly wage of the 40 Workers is equal to population mean of $13.20"
    H1: "The average hourly wage of the 40 Workers is less than the population mean of $13.20"

         Or, stated more formally:

                 H0: m = 13.20
                 H1: m < 13.20

                                    _
    Where we are given that n = 40, Xn = 12.20, 
    s = 2.50, and a = .01

    This is known as a one-tail test in that we are only testing the simple null hpothesis against all other possible values less than the value. In this case the generic test is:

        _
    If (Xn - m0)/s/n1/2 < -za then Reject H0:
     -z.01 = -2.33
     _
    (Xn - m0)/s/n1/2 = (12.20 - 13.20)/2.50/401/2 = -2.53
    Hence, since -2.53 < -2.33 we Reject H0:
  9. An alternative perspective on Hypothesis Testing is to compute the P-Value corresponding to the test statistic. For the example shown above (9):

    P-Value = F(-2.53) = .0057

    Which we can literally interpret as follows: in 57 of 10,000 random samples of size 40 from this distribution, we would obtain a sample mean of 12.20 or lower. Note that this is an a probability of .0057!

    In EViews you can calculate this probability by using the command:

    Scalar pval=@CNORM(-2.53)

    "pval" then appears in the variables window of EViews. If you then double-click on pval the value appears at the bottom of the window.




  10. The Hypothesis Test for a proportion against all possible alternative values (large sample size only, n > 50).

                 H0: p = p0
                 H1: p ¹ p0


         The decision rule for this problem is:

        Ù
    If (p - p0)/[p0(1 - p0)/n]1/2 > za/2 or 
        Ù  
       (p - p0)/[p0(1 - p0)/n]1/2 < -za/2 then Reject H0:
                Ù  
    If  -za/2 < (p - p0)/[p0(1 - p0)/n]1/2 < za/2 then Do Not Reject H0:
    
  11. Problem 10.14 p.424. We are given

    H0: p = .45
    H1: p ¹ .45


    Where a = .01, a/2 = .005, z.005 = 2.58, n = 80, and
          Ù
          p = 32/80 = .40
    Hence

    Test Statistic = (.40 - .45)/[(.45*.55)/80]1/2 = -.90

    Because -2.58 < -.90 < 2.58, Do not Reject H0:.

    The P-Value corresponding to the test statistic of -.90 is computed as:

    P-Value (Two Tail) = F(-.90) + 1 - F(.90) = .3682

  12. The Hypothesis Test for the Variance of a Normal Distribution

                 H0: s2 = s02
                 H1: s2 = s12 > s02


    The decision rule for this problem is:

    If (n-1)s2/ s02 > C2 Then Reject H0:

    Where P(c2n-1 > C2) = a
  13. Example:

                 H0: s2 = 400
                 H1: s2 = 900


    Where n = 25, s2 = 462.5, a = .05. Hence, with c224,.05, then C2 = 36.4151.

    Test Statistic = (24*462.5)/400 = 27.75 < 36.4151, so we Do Not Reject H0:

    To get the P-Value for this test use the EViews command:

    Scalar Pval=@Chisq(27.75,24)

    "Pval" will appear in the variables window. Double-click on Pval and the probability will appear at the bottom of the window.


  14. The Hypothesis Test for a Variance of a Normal Distribution against all possible alternative values

                 H0: s2 = s02
                 H1: s2 ¹ s02


    The decision rule for this problem is:

    If (n-1)s2/ s02 > C2 or (n-1)s2/ s02 < C1 Then Reject H0:

    Where P(c2n-1 > C2) = a/2 and P(c2n-1 < C1) = a/2

  15. Example:

                 H0: s2 = 400
                 H1: s2 ¹ 400


    Where n = 101, s2 = 631.266, a = .05, a/2 = .025. Hence, with c2100,.025, then
    C1 = 74.2219 and C2 = 129.561.

    Test Statistic = (100*631.266)/400 = 157.816 > 129.561, so we Reject H0:

    The P-Value for this test is: 2*P(c2100 > 157.816) = .0004

    Because the Chi-Square distribution is not symmetric, the "solution" for the two-tail P-Value is to find the relevant tail above/below the test statistic and multiply it by 2.

  16. Problem 10.72 p.455. Perform the following hypothesis test:

                 H0: "The variance of the aptitude test scores is 100"
                 H1: "The variance of the aptitude test scores is greater than 100"

    Or, stated more formally:

                 H0: s2 = 100
                 H1: s2 > 100

    Where we are given that n = 20, s2 = 144, and a = .01

    This is known as a one-tail test in that we are only testing the simple null hpothesis against all other possible values greater than the value. In this case the generic test is:

    If (n-1)s2/ s02 > C2 Then Reject H0:

    Hence, with c219,.01, then C2 = 36.1908. Hence:

    Test Statistic = (19*144)/100 = 27.36 < 36.1908, so we Do Not Reject H0:

    The P-Value for this test is: P(c219 > 27.36) = .09654

  17. Hypothesis Test for Difference in the Means of two Separate Normally Distributed Populations with Large Sample Size (n > 30 and m > 30)

                 H0: m1 = m2
                 H1: m1 ¹ m2

         or
                 H0: m1 - m2 = 0
                 H1: m1 - m2 ¹ 0


           _    _
    Where (Xn - Ym) ~ N(m1 - m2, s12/n + s22/m), or, 
    using the Central Limit Theorem
     _    _
    (Xn - Ym) ~ N(m1 - m2, s12/n + s22/m)
    
    The decision rule for this problem is:
        _    _
    If (Xn - Ym)/(s12/n + s22/m)1/2 > za/2 or 
        _    _
       (Xn - Ym)/(s12/n + s22/m)1/2 < -za/2 then Reject H0:
               _    _
    If -za/2 < (Xn - Ym)/(s12/n + s22/m)1/2 < za/2 then Do Not Reject H0:
    
  18. Example: Given n1 = 50, n2 = 50, s1 = 5.2, s2 = 4.3
     _          _
     Xn = 11.5, Ym = 13.0
    Where a = .05, a/2 = .025, and z.025 = 1.96

    Test Statistic: (11.5 - 13.0)/(5.22/50 + 4.32/50)1/2 = -1.572.

    Since -1.96 < -1.572 < 1.96, Do Not Reject H0:

    P-Value (Two Tail) = F(-1.572) + 1 - F(1.572) = .1160

  19. Hypothesis Test for Difference in the Means of two Separate Normally Distributed Populations with Small Sample Size (n < 30 and m < 30)

                 H0: m1 - m2 = 0
                 H1: m1 - m2 ¹ 0


    Here we must assume that the variances of the two populations are the same. Namely:

    s12 = s22

    Our sample variance is computed by pooling the sum of squares of the two random samples. That is:

    s2 = [(n - 1)s12 + (m - 1)s22]/(n + m - 2)

              _    _
    So that: (Xn - Ym)/[s(1/n + 1/m)1/2] ~ tn+m-2
    
    The decision rule for this problem is:
        _    _
    If (Xn - Ym)/[s(1/n + 1/m)1/2] > ta/2 or 
         _    _
        (Xn - Ym)/[s(1/n + 1/m)1/2] < -ta/2then Reject H0:
                _    _
    If  -ta/2 < (Xn - Ym)/[s(1/n + 1/m)1/2] < ta/2
        then Do Not Reject H0:
    
  20. Problem 10.62 p.446

                 H0: m1 - m2 = 0,    There is no effect.
                 H1: m1 - m2 > 0,    There is an effect.


    Given n1 = 7, n2 = 7, s1 = .32, s2 = .32
     _          _
     Xn = 1.26, Ym = .78
    Where a = .05, and t.05,12 = 1.782

    s2 = (6*.322 + 6*.322)/12 = .1024

    Test Statistic: (1.26 - .78)/[.1024(1/7 + 1/7)]1/2 = 2.806 > 1.782, So we Reject H0:.

    The P-Value for this test is: P(T12 > 2.806) = .0079

    To get the P-Value using EViews use the command:

    Scalar Pval=@Tdist(2.806,12)

    Double-click on "Pval" and the two-tail P-Value will appear at the bottom of the window. In this instance it is .015867. Divide this by 2 to get the correct P-Value for a one-tail test.


  21. Problem 10.105 p.473

                 Ho: m1 - m2 = 0,    There is no difference between the furnaces.
                 H1: m1 - m2 ¹ 0,    There is a difference.


                               _             _
    We are given n = 8, m = 6, Xn = 73.125,  Ym = 77.667, 
    s12 = 9.554, s22 = 10.667
    
    So that s2 = (7*9.554 + 5*10.667)/12 = 10.018

    Test Statistic: (73.125 - 77.667)/[10.018(1/8 + 1/6)]1/2 = -2.657

    P-Value (Two Tail) = P(T12 < -2.657) + P(T12 > 2.657) = .0209

  22. The Hypothesis Test for the Equivalence of proportions from two populations (large sample size only, n > 50, m > 50).

                 Ho: p1 - p2 = 0
                 H1: p1 - p2 ¹ 0


         The decision rule for this problem is:
         Ù    Ù                 Ù      Ù         Ù      Ù
    If [(p1 - p2) - (p1 - p2)]/{[p1(1 - p1)/n] + [p2(1 - p2)/m]}1/2 > za/2 or 
         Ù    Ù                 Ù      Ù         Ù      Ù
       [(p1 - p2) - (p1 - p2)]/{[p1(1 - p1)/n] + [p2(1 - p2)/m]}1/2 < -za/2
               then Reject Ho:
                 Ù    Ù                  Ù      Ù        Ù      Ù
    If  -za/2 < [(p1 - p2) - (p1 - p2)]/{[p1(1 - p1)/n] + [p2(1 - p2)/m]}1/2 <
            za/2 then Do Not Reject Ho:
    
    Alternatively, given that our null hypothesis is that p1 = p2, we can pool the two samples to get a better estimate of the variance:
                          Ù     Ù
                   Ù     np1 + mp2
                   p =  ---------
                          n + m
    
    Then this produces the decision rule:
         Ù    Ù                Ù     Ù 
    If [(p1 - p2) - (p1 - p2)]/[p(1 - p)(1/n + 1/m)]1/2 > za/2 or 
         Ù    Ù                Ù     Ù
       [(p1 - p2) - (p1 - p2)]/[p(1 - p)(1/n + 1/m)]1/2 < -za/2 then Reject Ho:
                 Ù    Ù                 Ù     Ù 
    If  -za/2 < [(p1 - p2) - (p1 - p2)]/[p(1 - p)(1/n + 1/m)]1/2 < za/2 then 
              Do Not Reject Ho:
    
    For all practical purposes, these two decision rules produce virtually identical results statistically.

  23. Problem 10.16 p.424.

    1. We are given

      Ho: p1 - p2 = 0,     Aspirin Use the Same in Both Years
      H1: p1 - p2 ¹ 0,     Aspirin Use Differs


      Where a = .05, a/2 = .025, z.025 = 1.96, n = m = 1000, and
            Ù              Ù
            p1 = .45  and  p2 = .34
      
      Hence

      1st Test Statistic = (.45 - .34)/{[(.45*.55)/1000][(.34*.66)/1000]}1/2 = 5.064

      Combining the Samples:
                       Ù     Ù
                Ù     np1 + mp2    1000*.45 + 1000*.34
                p =  ---------- = -------------------- = .395
                        n + m          1000 + 1000
      
      2nd Test Statistic = (.45 - .34)/[(.395*.605)/(1/1000 + 1/1000)]1/2 = 5.032

      In both tests we Reject Ho:.

      The P-Values corresponding to the two test statistics are:

      P-Value (Two Tail 1st test) = F(-5.064) + 1 - F(5.064) = .000000411

      P-Value (Two Tail 2nd test) = F(-5.032) + 1 - F(5.032) = .000000486

    2. We are given

      Ho: p1 - p2 = 0,     Ibuprofen Use has not Incresed
      H1: p1 - p2 < 0,     Ibuprofen Use Has Increased


      Where a = .05, z.05 = 1.645, n = m = 1000, and
            Ù              Ù
            p1 = .14  and  p2 = .26
      
      Hence

      1st Test Statistic = (.14 - .26)/{[(.14*.86)/1000][(.26*.74)/1000]}1/2 = -6.785

      Combining the Samples:
                       Ù     Ù
                Ù     np1 + mp2    1000*.14 + 1000*.26
                p =  ---------- = -------------------- = .2  
                        n + m          1000 + 1000
      
      2nd Test Statistic = (.14 - .26)/[(.2*.8)/(1/1000 + 1/1000)]1/2 = -6.708

      In both tests we Reject Ho:.

      The P-Values corresponding to the two test statistics are:

      P-Value (One Tail 1st test) = F(-6.785) = .00000000000584

      P-Value (One Tail 2nd test) = F(-6.708) = .00000000000992

    3. The tests in a) and b) are related because as aspirin use goes down, Ibuprofin use must certainly increase (not all the increase is due to Acetaminophen.

  24. The Hypothesis Test for the Equivalence of the Variances from Two Normally Distributed Populations

                 Ho: s12 = s22
                 H1: s12 ¹ s22


    Here our test statistic is the ratio of the two sample variances which is known to have an F-Distribution. Specifically:

    s12/s22 ~ Fn-1,m-1 df

    Where the F-Distribution has n-1 degrees of freedom associated with the numerator, and m-1 degrees of freedom associated with the denominator.

    The decision rule for this problem is:

    If s12/s22 > K2 or s12/s22 < K1 Then Reject Ho:

    Where P(Fn-1,m-1 > K2) = a/2 and P(Fn-1,m-1 < K1) = a/2

  25. The K2 values are given in the F Table on pages 734-743 of MWS. To get the K1 values, reverse the order of the degrees of freedom and take the reciprocal in the table. That is:

    K2 = Fn-1,m-2, a/2 and K1 = 1/Fm-1,n-2, a/2

  26. Problem 10.73 p.455. Perform the following hypothesis test:

                 Ho: "The Variance of the DDT samples for the Juvenile Brown Pelicans
                              is the same as that for the Nestlings"
                 H1: "The Variance of the DDT sample for the Juveniles is greater than the
                              Variance for the Nestlings"

         Or, stated more formally:

                 Ho: s12 = s22
                 H1: s12 > s22

    Where we are given that n1 = 10, n2 = 13, s1 = .017, and s2 = .006, a = .01

    This is a one-tail test in that we are only testing the simple null hpothesis against all other possible values greater than the value. In this case the generic test is:

                 If s12/s22 > K2 Then Reject Ho:

    Here F9,12,.05 = 2.80
    The test statistic is: (.017)2/(.006)2 = 8.03 > 2.80 so we Reject Ho:

    The P-Value = P(F9,12 > 8.03) = .00072


  27. However, note that there is a fundamental ambiguity here. Namely, which population do we treat as population 1?! It is clearly an arbitrary choice. Consequently, many practitioners have adopted the quite reasonable position that all F-Tests Should Be One-Tail with the larger of the two sample variances used in the numerator of the test statistic so that the test statistic is always greater than one. Note that, for a fixed a, this makes it more likely that the null hypothesis will be rejected. This is a judgement call on the part of the practitioner. A neutral approach is to compute the P-Value associated with the one-tail of the test statistic and interpret it as either a or a/2 depending upon the substantive circumstances of the test.

  28. Problem 10.103 p.473. Perform the following hypothesis test:

                 Ho: s12 = s22
                 H1: s12 ¹ s22

    Where we are given that n1 = 10, n2 = 10, s12 = .273, and s22 = .094, a = .1, a/2 = .05,
    K2 = F9,9,.05 = 3.18 and K1 = 1/F9,9,.05 = 1/3.18 = .3145

    The test statistic is: .273/.094 = 2.904. Hence, since

    .3145 < 2.904 < 3.18 Do Not Reject Ho:

    Note that if we had performed a one-tail test for this problem with a = .1, we would reject Ho:! In this case:

    K2 = F9,9,.10 = 2.44

    Since 2.904 > 2.44 we would reject Ho:

    The P-Value = P(F9,9 > 2.904) = .06403