Surfstat.australia: an online text in introductory Statistics

STATISTICAL INFERENCE

COMPARING MEANS OF TWO CONTINUOUS VARIABLES

Introduction

Example - From the MINITAB handbook page 101

"A shoe company wanted to compare two materials (A and B) for use on the soles of boys' shoes. We could design an experiment to compare the two materials in two ways. One design might be to recruit ten boys (or more if our budget allowed) and give five of the boys shoes with material A and give five boys shoes with material B. Then after a suitable length of time, say three months, we could measure the wear on each boy's shoes. This would lead to independent samples. Now, you would expect a certain variability among ten boys - some boys wear out shoes much faster than others. A problem arises if this variability is large. It might completely hide an important difference between the two materials.

An alternative design, a paired design, attempts to remove some of this variability from the analysis so we can see more clearly any differences between the materials we are studying. Again, suppose we started with the same ten boys, but this time had each boy test both materials. There are several ways we could do this. Each boy could wear material A for three months, then material B for a second three months. Or we could give each boy a special pair of shoes with the sole on one shoe made from material A and the other from material B. This latter procedure produced the date in the table below:"
BoyMaterial AMaterial B
113.214.0
28.28.8
310.911.2
414.314.2
510.711.8
66.66.4
79.59.8
810.811.3
98.89.3
1013.313.6

MTB> DotPlot 'materA' 'materB';
SUBC>   Same.

       .          .   .   .       ...              ..    .
   +---------+---------+---------+---------+---------+-------materA 

      .               .  .  .         :   .           . .  .
   +---------+---------+---------+---------+---------+-------materB 
 6.0       7.5       9.0      10.5      12.0      13.5

MTB> desc c1 c2

                N     MEAN   MEDIAN   TRMEAN    STDEV   SEMEAN
materA         10   10.630   10.750   10.675    2.451    0.775
materB         10   11.040   11.250   11.225    2.518    0.796

              MIN      MAX       Q1       Q3
materA      6.600   14.300    8.650   13.225
materB      6.400   14.200    9.175   13.700

The first design results in two independent samples, while the second design contains dependent samples. Different methods of analysis are appropriate in each case.

Independent Samples

Suppose we have data from two samples, size n1 and n2, which come from two populations which may or may not have the same means:
R.V. for sample data Population parameters
X1, X2, ..., Xn1 µX, sX
Y1, Y2, ..., Yn1 µY, sY

To compare the population means µx and µy you could find a confidence interval for (µX - µY) or test the null hypothesis

H0 : µX = µY , i.e. µX - µY = 0 against the alternative hypothesis

H1 : µX µY , i.e. µX - µY 0

To estimate µX - µY use the difference between the sample means ( - )

To obtain the sampling distribution of ( - ) assume that X and Y are independent.

Using results on the sampling distribution of a mean we obtain

~ N(µx, ) , ~ N(µy, )

Then

E( - ) = E() - E() = µX - µY

var( - ) = var() + var() = +

if X and Y are independent.

Also ( - ) is approximately Normally distributed so that

or Z =

In practice sX and sY are usually unknown so you would use sample standard deviations sX and sY to estimate sX and sY There are two cases to consider.

Case 1 (t-test)

If we assume that s2X s2Y = s2 then a good estimate for s2 is the pooled sample variance

where sX2 and sY2 were calculated using denominators (n1 - 1) and (n2 - 1).

Then the following t-statistic can be used to construct 95% C.I. or p-values.

t =

with (n1 + n2 - 2) degrees of freedom.

Case 2 (Welch's test)

If s2X and s2Y are unlikely to be equal you should use

t =

with degrees of freedom where

When doing calculations without a computer, it can be time consuming to calculate the degrees of freedom for Welsh's t-test. In this situation, the t-distribution with degrees of freedom equal to the smaller of n1-1 and n2-1 can be used to find critical values.

As the sample sizes increase, probability values based on this assumption become more accurate.

NOTE: this method will not be used in this course. We will assume Case 1 applies.

In this course, we will assume that the population variances are equal s2X = s2Y and use a pooled estimate of variance.

Example - Boys' shoes

For boy's shoes

= 10.63, sX = 2.451, n1 = 10

= 11.04, sY = 2.518, n2 = 10

If we assume that the two samples of shoe wear measurements were independent, then the following analysis could be done. In fact, since the data in the two samples are not independent, because the same boys were used each time, the correct analysis would be to use a paired samples method.

Test H0 : µX = µY versus H1 : µX µY

Assume sX = sY and assume independent samples and so use

Note spooled lies between sX and sY as required.

To calculate the test statistic, assume H0 is true. If H0 is true then µX - µY = 0 so the observed value of the t-statistic is


this t-statistic has 10 + 10 - 2 = 18 degrees of freedom.

The p-value is the probability of observing the value -0.37, or an even more extreme value, in either direction

p = Pr(t18< - 0.37 or t18> 0.37)

= 2 × P(t18> 0.37)

> 2 × P(t18> 0.688) (0.688 is the nearest tabulated value)

> 2 × 0.25 > 0.5

As the p-value is greater than 0.05 (ie. it is not small) do not reject H0. The difference between the sample means is not statistically significant.

Conclusion - The data are consistent with H0 : µX = µY

i.e. there is no evidence that the average wear is different for materials A and B

Remarks

The MINITAB command is "TWOSAMPLE". (Welch's test is used if the subcommand POOLED is not included.)

MTB> twosample c1 c2;
SUBC> pooled.

TWOSAMPLE T FOR materA VS materB

           N        MEAN       STDEV     SE MEAN
materA    10       10.63        2.45        0.78
materB    10       11.04        2.52        0.80

95 PCT CI FOR MU materA - MU materB: (-2.75, 1.93)

TTEST MU materA = MU materB (VS NE): T= -0.37  P=0.72  DF= 18

POOLED STDEV = 2.49

The 95% C.I. for µX = µY can be constructed in usual way:

Find the value c such that Pr(-c < t18< c) = 0.95.

Table 2 gives a value of c = 2.101 for t with 18d.f.

95% CI = ( - ) ± 2.101 spooled

= (10.63 - 11.04) ± 2.101 × 2.485 ×

= - 0.41 ± 2.33

= (-2.74, 1.92)

The value 0 is contained in this interval and hence data are consistent with µX - µY = 0 and so provide no evidence for a difference in the population means.


... Previous page Next page ...