Hypothesis Testing of the Difference Between Two Population Means


This file is part of a program based on the Bio 4835 Biostatistics class taught at Kean University in Union, New Jersey.  The course uses the following text:
Daniel, W. W. 1999.  Biostatistics: a foundation for analysis in the health sciences.  New York: John Wiley and Sons.  
The file follows this text very closely and readers are encouraged to consult the text for further information.

B)  Hypothesis testing of the difference between two population means

This is a two sample z test which is used to determine if two population means are equal or unequal.  There are three possibilities for formulating hypotheses.

l.        H0mu1mu2         HAmu1  not equal to  mu2

2.      H0mu1  greater than or equal to  mu2         HAmu1mu2

3.      H0mu1  less than or equal to  mu2         HAmu1mu2

 Procedure

The same procedure is used in three different situations

  • Sampling is from normally distributed populations with known variances

                z score formula
    

  • Sampling from normally distributed populations where population variances are unknown
    • population variances equal

                            t formula
                     This is with t distributed as Student's t distribution with (n1 + n2-2) degrees of freedom and a pooled variance.

    • population variances unequal

When population variances are unequal, a distribution of t' is used in a manner similar to calculations of confidence intervals in similar circumstances.

  • Sampling from populations that are not normally distributed


If both sample sizes are 30 or larger the central limit theorem is in effect.  The test statistic is

                        z score formula        
If the population variances are unknown, the sample variances are used.


Sampling from normally distributed populations with population variances known

Example 7.3.1

Serum uric acid levels

Is there a difference between the means between individuals with Down's syndrome and normal individuals?

(1) Data

         x-bar-1= 4.5   n1 = 12    = 1
         x-bar-2 = 3.4   n2 = 15   sigma 2 squared = 1.5
         alpha = .05

(2) Assumptions

  •     two independent random samples
  •     each drawn from a normally distributed population


(3) Hypotheses

        H0 :  mu1mu2
        HA :  mu1  not equal to  mu2
 
(4) Test statistic

This is a two sample z test.

        (a) Distribution of test statistic

If the assumptions are correct and H0 is true, the test statistic is distributed as the normal distribution.
   
        (b)  Decision rule

With alpha = .05, the critical values of z are -1.96 and +1.96.  We reject H0 if z < -1.96 or z > +1.96.

 (5) Calculation of test statistic

        z score
 
 (6) Statistical decision

Reject H0 because 2.57 > 1.96.

(7) Conclusion

From these data, it can be concluded that the population means are not equal.  A 95% confidence interval would give the same conclusion.

        p = .0102.


Sampling from normally distributed populations with unknown variances

With equal population variances, we can obtain a pooled value from the sample variances.

Example 7.3.2

Lung destructive index

We wish to know if we may conclude, at the 95% confidence level, that smokers, in general, have greater lung damage than do non-smokers.

(1) Data

Smokers:            x-bar1= 17.5   n1 = 16   s1-squared = 4.4752
Non-Smokers:    x-bar2= 12.4   n2 =   9   s2 squared = 4.8492
                           alpha = .05

Calculation of Pooled Variance:

        pooled variance calculation
 
(2) Assumptions

  •     independent random samples
  •     normal distribution of the populations
  •     population variances are equal


(3) Hypotheses

        H0 :  mu1  less than or equal to mu2
        HA :  mu1mu2

(4) Test statistic

        t score
        (a) Distribution of test statistic

If the assumptions are met and H0 is true, the test statistic is distributed as Student's t distribution with 23 degrees of freedom.

        (b) Decision rule

With alpha = .05 and df = 23, the critical value of t is 1.7139.  We reject H0 if t > 1.7139.

(5) Calculation of test statistic

        t score calculation
 
(6) Statistical decision

Reject H0 because 2.6563 > 1.7139.

(7) Conclusion

On the basis of the data, we conclude that mu1> mu2.

Actual values
    t = 2.6558
    p = .014

Sampling from populations that are not normally distributed

Example 7.3.4

These data were obtained in a study comparing persons with disabilities with persons without disabilities.  A scale known as the Barriers to Health Promotion Activities for Disabled Persons (BHADP) Scale gave the data.  We wish to know if we may conclude, at the 99% confidence level, that persons with disabilities score higher than persons without disabilities.

(1) Data

Disabled:            x-bar1 = 31.83   n1 = 132   s1 = 7.93
Nondisabled:      x-bar2= 25.07   n2 = 137   s2 = 4.80
                          alpha = .01


(2) Assumptions

  •     independent random samples


(3) Hypotheses

        H0 :  mu1  less than or equal to  mu2
        HA :  mu1mu2

(4) Test statistic

Because of the large samples, the central limit theorem permits calculation of the z score as opposed to using t.  The z score is calculated using the given sample standard deviations.

        (a) Distribution of test statistic

If the assumptions are correct and H0 is true, the test statistic is approximately normally distributed

        (b) Decision rule

With alpha = .01 and a one tail test, the critical value of z is 2.33.  We reject H0 z > 2.33.


(5) Calculation of test statistic

        z score calculation 

(6) Statistical decision

Reject H0 because 8.42 > 2.33.

(7) Conclusion

On the basis of these data, the average persons with disabilities score higher on the BHADP test than do the nondisabled persons.

Actual values
    z = 8.42
    p = 1.91 x 10-17

Paired comparisons

Sometimes data comes from nonindependent samples.  An example might be testing "before and after" of cosmetics or consumer products.  We could use a single random sample and do "before and after" tests on each person.  A hypothesis test based on these data would be called a paired comparisons test.  Since the observations come in pairs, we can study the difference, d, between the samples.  The difference between each pair of measurements is called di.

Test statistic

With a population of n pairs of measurements, forming a simple random sample from a normally distributed population, the mean of the differencemu-sub-d , is tested using the following implementation of t.

        t score formula
 
 
Paired comparisons

Example 7.4.1

Very-low-calorie diet (VLCD) Treatment

Table gives B (before) and A (after) treatment data for obese female patients in a weight-loss program.

        data table

We calculate di = A-B for each pair of data resulting in negative values meaning that the participants lost weight.

We wish to know if we may conclude, at the 95% confidence level, that the treatment is effective in causing weight reduction in these people.

(1)  Data

Values of di are calculated by subtracting each A from each B to give a negative number.  On the TI-83 calculator place the A data in L1 and the B data in L2.  Then make L3 = L1 - L2 and the calculator does each calculation automatically.  

In  Microsoft Excel put the A data in column A and the B data in column B, without using column headings so that the first pair of data are on line 1.  In cell C1, enter the following formula:  =a1-b1.  This calculates the difference, di, for B - A.  Then copy the formula down column C until the rest of the differences are calculated.

 n = 9
alpha = .05

(2) Assumptions

  • the observed differences are a simple random sample from a normally distributed population of differences


(3) Hypotheses

        H0:  mu sub d greater than or equal to0
        HA:  mu sub d < 0 (meaning that the patients lost weight)

(4) Test statistic

The test statistic is t which is calculated as

        t formula
            
        (a) Distribution of test statistic

The test statistic is distributed as Student's t with 8 degrees of freedom

        (b) Decision rule

With alpha = .05 and 8 df the critical value of t is -1.8595.  We reject H0 if t < -1.8595.

 (5) Calculation of test statistic

        calculation
 
(6) Statistical decision

Reject H0 because -12.7395 < -1.8595
p = 6.79 x 10-7

(7) Conclusion

On the basis of these data, we conclude that the diet program is effective.

Other considerations

  • a confidence interval for mu sub d can be constructed 
  • z can be used if the variance is known or if the sample is large