PERTEMUAN 5
PENGUJIAN HIPOTESIS (part 2)
Mata Kuliah : Metode Statistika 2
Politeknik Statistika STIS
                 OUTLINE
Prosedur Pengujian Hipotesis untuk:
◼ Beda 2 rata-rata pada sampel independen
◼ Beda 2 rata-rata pada sampel dependen
  (data berpasangan)
◼ Beda 2 proporsi
◼ Rasio 2 varians
    Hypothesis Tests for the Difference
          Between Two Means
◼   Testing Hypothesis about μ1 – μ2
◼   Use the same situations discussed already:
    ◼   Standard deviations known or unknown
    ◼   Sample sizes  30 or not  30
                Hypothesis Tests for
              Two Population Proportions
        Two Population Means, Independent Samples
Lower tail test:    Upper tail test:   Two-tailed test:
  H0: μ1  μ2         H0: μ1 ≤ μ2        H0: μ1 = μ2
  HA: μ1 < μ2         HA: μ1 > μ2        HA: μ1 ≠ μ2
      i.e.,               i.e.,              i.e.,
H0: μ1 – μ2  0     H0: μ1 – μ2 ≤ 0    H0: μ1 – μ2 = 0
HA: μ1 – μ2 < 0     HA: μ1 – μ2 > 0    HA: μ1 – μ2 ≠ 0
       Hypothesis tests for μ1 – μ2
Population means, independent samples
σ1 and σ2 known          Use a z test statistic
                         Use s to estimate unknown
σ1 and σ2 unknown,       σ , approximate with a z
   n1 and n2  30        test statistic
σ1 and σ2 unknown,       Use s to estimate unknown
    n1 or n2 < 30        σ , use a t test statistic
                    σ1 and σ2 known
Population means,
  independent                 The test statistic for
    samples                       μ1 – μ2 is:
   σ1 and σ2 known      *   z=
                               ( x − x )− ( μ − μ )
                                  1     2      1       2
                                         2         2
   σ1 and σ2 unknown,                 σ    σ2
      n1 and n2  30
                                        1
                                         +
                                      n1   n2
   σ1 and σ2 unknown,
       n1 or n2 < 30
      σ1 and σ2 unknown, large samples
Population means,
  independent                 The test statistic for
    samples                       μ1 – μ2 is:
   σ1 and σ2 known
                            z=
                               ( x − x )− ( μ − μ )
                                  1     2      1       2
   σ1 and σ2 unknown,
      n1 and n2  30
                        *             s
                                        +
                                        1
                                         2
                                          s2
                                                2
                                      n1 n2
   σ1 and σ2 unknown,
       n1 or n2 < 30
      σ1 and σ2 unknown, small samples
                            *Assuming equal variances
Population means,
  independent           The test statistic for μ1 – μ2 is:
                                 ( x − x )− ( μ − μ )
    samples
                              t=
                                          1         2          1          2
   σ1 and σ2 known
                                                        1 1
                                              sp          +
   σ1 and σ2 unknown,                                   n1 n 2
      n1 and n2  30
                             Where t/2 or t has (n1 + n2 – 2) d.f.,
   σ1 and σ2 unknown,
       n1 or n2 < 30
                        *    and
                                   sp =
                                              (n1 − 1)s12 + (n2 − 1)s22
                                                    n1 + n2 − 2
      σ1 and σ2 unknown, small samples
                        *Assuming different variances
Population means,
  independent           The test statistic for μ1 – μ2 is:
                                ( x − x )− ( μ − μ )
    samples
                             t=
                                            1          2                1       2
   σ1 and σ2 known                                      2              2
                                                       s s
                                                        1
                                                         +             2
   σ1 and σ2 unknown,                                  n1 n 2
      n1 and n2  30
                            Where t/2 or t has d.f.,
                                                   2           2
   σ1 and σ2 unknown,   *        (s
                                                 s
                                                (1     n1
                                                             s
                                                            + 2    n2 ) 2
                                       n ) /(n − 1)+ (s                             
                            v=
       n1 or n2 < 30               2
                                   1    1
                                            2
                                                1
                                                                   2
                                                                   2        )
                                                                            2
                                                                       n2 /(n2 − 1)
            Hypothesis tests for μ1 – μ2
           Two Population Means, Independent Samples
    Lower tail test:   Upper tail test:         Two-tailed test:
    H0: μ1 – μ2  0    H0: μ1 – μ2 ≤ 0          H0: μ1 – μ2 = 0
    HA: μ1 – μ2 < 0    HA: μ1 – μ2 > 0          HA: μ1 – μ2 ≠ 0
                                             /2               /2
    -z                               z          -z/2        z/2
Reject H0 if z < -z   Reject H0 if z > z     Reject H0 if z < -z/2
                                                         or z > z/2
       Pooled sp t Test: Example
You’re a financial analyst for a brokerage firm. Is there a
difference in dividend yield between stocks listed on the
NYSE & NASDAQ? You collect the following data:
                    NYSE NASDAQ
Number                21          25
Sample mean          3.27       2.53
Sample std dev 1.30             1.16
Assuming equal variances, is
there a difference in average
yield ( = 0.05)?
                                Solution
                                     Reject H0          Reject H0
H0: μ1 - μ2 = 0 i.e. (μ1 = μ2)
HA: μ1 - μ2 ≠ 0 i.e. (μ1 ≠ μ2)
 = 0.05                                 .025            .025
df = 21 + 25 - 2 = 44                    -2.0154   0 2.0154     t
Critical Values: t = ± 2.0154
                                                        2.040
Test Statistic:                     Decision:
          3.27 − 2.53               Reject H0 at  = 0.05
    t=                = 2.040
                1 1
       1.2256      +                Conclusion:
                21 25               There is evidence of a
                                    difference in means.
          Calculating the Test Statistic
       The test statistic is:
       t=
          (x − x )− (μ − μ ) (3.27 − 2.53) − 0
              1        2
                            =  1       2
                                               = 2.040
                           1 1                     1 1
                  sp         +              1.2256   +
                           n1 n 2                  21 25
sp =
       (n1 − 1)s12 + (n2 − 1)s22   =
                                       (21− 1)1.302 + (25 − 1)1.162   = 1.2256
             n1 + n2 − 2                       21+ 25 − 2
               Hypothesis Testing for
                  Paired Samples
                    The test statistic for d is
  Paired
 samples
                               d − μd
                            t=
                                 sd
                                  n
n is the
number                                        n
of pairs
in the
           Where t/2 has n - 1 d.f.           i
                                               (d − d) 2
paired                  and sd is:     sd =   i=1
sample                                              n −1
                  Hypothesis Testing for
                     Paired Samples
                                                                (continued)
                        Paired Samples
    Lower tail test:      Upper tail test:          Two-tailed test:
      H0: μd  0            H0: μd ≤ 0                 H0: μd = 0
      HA: μd < 0            HA: μd > 0                 HA: μd ≠ 0
                                                 /2                 /2
    -t                                  t           -t/2         t/2
Reject H0 if t < -t     Reject H0 if t > t       Reject H0 if t < -t/2
                                                             or t > t/2
                       Where t has n - 1 d.f.
               Paired Samples Example
        ◼ Assume you send your salespeople to a “customer
        service” training workshop. Is the training effective?
        You collect the following data:
            Number of Complaints:   (2) - (1)                  di
Salesperson Before (1) After (2)  Difference, di     d =       n
    C.B.          6         4           - 2
                                                          = -4.2
    T.F.         20         6           -14
    M.H.          3         2           - 1
    R.K.
    M.O.
                  0
                  4
                            0
                            0
                                          0
                                        - 4        sd =
                                                           i
                                                           (d − d) 2
                                        -21                   n −1
                                                     = 5.67
             Paired Samples: Solution
▪ Has the training made a difference in the number of
complaints (at the 0.01 level)?
                                      Reject                 Reject
       H0: μd = 0
       HA: μd  0
                                        /2                       /2
   = .01      d = - 4.2                   - 4.604        4.604
                                                - 1.66
 Critical Value = ± 4.604
       d.f. = n - 1 = 4
                                  Decision: Do not reject H0
                                  (t stat is not in the reject region)
     Test Statistic:
                                  Conclusion: There is not a
   d − μd − 4.2 − 0
t=       =          = −1.66       significant change in the
   sd / n 5.67/ 5                 number of complaints.
                Hypothesis Tests for
              Two Population Proportions
                   Population proportions
Lower tail test:       Upper tail test:     Two-tailed test:
  H0: p1  p2            H0: p1 ≤ p2          H0: p1 = p2
  HA: p1 < p2            HA: p1 > p2          HA: p1 ≠ p2
      i.e.,                  i.e.,                i.e.,
H0: p1 – p2  0        H0: p1 – p2 ≤ 0      H0: p1 – p2 = 0
HA: p1 – p2 < 0        HA: p1 – p2 > 0      HA: p1 – p2 ≠ 0
          Two Population Proportions
                Since we begin by assuming the null
                hypothesis is true, we assume p1 = p2
Population
                and pool the two 𝑝Ƹ estimates
proportions
                      The pooled estimate for the
                         overall proportion is:
                     n1 pˆ1 + n 2 pˆ 2 x1 + x 2
                pˆ =                  =
                        n1 + n 2        n1 + n 2
                  where x1 and x2 are the numbers from
              samples 1 and 2 with the characteristic of interest
          Two Population Proportions
                                                   (continued)
Population       The test statistic for
proportions          p1 – p2 is:
               z=
                    ( pˆ1 − pˆ 2 ) − ( p1 − p2 )
                                     1 1
                       pˆ (1 − pˆ )  + 
                                      n1 n2 
                   Hypothesis Tests for
                 Two Population Proportions
                       Population proportions
    Lower tail test:       Upper tail test:        Two-tailed test:
    H0: p1 – p2  0        H0: p1 – p2 ≤ 0         H0: p1 – p2 = 0
    HA: p1 – p2 < 0        HA: p1 – p2 > 0         HA: p1 – p2 ≠ 0
                                                /2                /2
    -z                                  z          -z/2        z/2
Reject H0 if z < -z      Reject H0 if z > z     Reject H0 if z < -z/2
                                                            or z > z/2
                    Example:
             Two population Proportions
    Is there a significant difference between the
     proportion of men and the proportion of
     women who will vote Yes on Proposition A?
◼   In a random sample, 36 of 72 men and 31 of
    50 women indicated they would vote Yes
◼   Test at the .05 level of significance
                          Example:
                   Two population Proportions
                                                           (continued)
    ◼    The hypothesis test is:
H0: p1 – p2 = 0 (the two proportions are equal)
HA: p1 – p2 ≠ 0 (there is a significant difference between proportions)
◼       The sample proportions are:
        ◼   Men:        𝑝Ƹ1 = 36/72 = .50
        ◼   Women:      𝑝Ƹ 2 = 31/50 = .62
    ▪ The pooled estimate for the overall proportion is:
                    x1 + x 2 36 + 31 67
               pˆ =         =       =    = .549
                    n1 + n 2 72 + 50 122
                            Example:
                     Two population Proportions
                                                                      (continued)
                                                      Reject H0         Reject H0
The test statistic for p1 – p2 is:
                                                       .025               .025
z=
      ( pˆ1 − pˆ 2 ) − ( p1 − p2 )
                     1 1 
        pˆ (1 − pˆ ) +                                -1.96        1.96
                      n1 n 2                                -1.31
  =
            ( .50 − .62) − ( 0)      = − 1.31
                        1  1                  Decision: Do not reject H0
       .549 (1 − .549)  + 
                        72 50 
                                                Conclusion: There is not
                                                significant evidence of a
   Critical Values = ±1.96
         For  = .05                            difference in proportions
                                                who will vote yes between
                                                men and women.
         Hypothesis Tests for
       Two Population Variances
                             Hypothesis Tests for Variances
H0: σ12 – σ22 = 0
                  Two tailed test
                                      *      Tests for Two
HA: σ1 – σ2 ≠ 0
      2     2                             Population Variances
H0: σ12 – σ22  0   Lower tail test
HA: σ12 – σ22 < 0                            F test statistic
H0: σ12 – σ22 ≤ 0   Upper tail test
HA: σ12 – σ22 > 0
           F Test for Difference in Two
              Population Variances
                                    Hypothesis Tests for Variances
The F test statistic is:
                         2
                  s                                  Tests for Two
               F=        1
                         2                        Population Variances
                  s      2
s12         = Variance of Sample 1
                                              *      F test statistic
      n1 - 1 = numerator degrees of freedom
s22        = Variance of Sample 2
       n2 - 1 = denominator degrees of freedom
                    Finding the Critical Value
                                                                     H0: σ12 – σ22 = 0
                     H0: σ12 – σ22 ≤ 0                               HA: σ12 – σ22 ≠ 0
                     HA: σ12 – σ22 > 0
                                                                              /2
                                             /2
    0                                    F         0                                     F
         Do not            Reject H0                      Do not          Reject H0
        reject H0   F                                   reject H0    F/2
◼ rejection region                                 ◼   rejection region for
for a one-tail test                                    a two-tailed test is
(upper tail test) is
                                                 s12               s 2
                 s     2
                                              F = 2  F / 2 or F = 12  F1− / 2
              F=    F1
                       2                         s2                s2
                 s     2
            F Test: An Example
You are a financial analyst for a brokerage firm. You
want to compare dividend yields between stocks listed
on the NYSE & NASDAQ. You collect the following data:
               NYSE       NASDAQ
Number             21             25
Mean             3.27           2.53
Std dev          1.30           1.16
Is there a difference in the
variances between the NYSE                    &
NASDAQ at the  = 0.1 level?
           F Test: Example Solution
◼   Form the hypothesis test:
     H0: σ21 – σ22 = 0 (there is no difference between variances)
     HA: σ21 – σ22 ≠ 0 (there is a difference between variances)
              ◼   Find the F critical value for  = .1:
                             ◼ Numerator:
                       ◼ df1 = n1 – 1 = 21 – 1 = 20
                            ◼ Denominator:
                       ◼ df2 = n2 – 1 = 25 – 1 = 24
                  F.95, 20, 24 = 0,48   or   F.05, 20, 24 = 2.03
             F Test: Example Solution
                                                                  (continued)
◼   The test statistic is:                              H0: σ12 – σ22 = 0
                                                        HA: σ12 – σ22 ≠ 0
      s12 1.302
    F= 2 =    2
                = 1.256
      s2 1.16
                                                                  /2 = .05
                                        0
    ◼Conclusion : do not reject H0           Do not          Reject H0
                                            reject H0    F/2 =2.03
    ◼ There is no evidence of a
    difference in variances at  = .1