You are on page 1of 28

MATH& 146

Lesson 30
Section 4.3
Difference of Two Means

1
Difference of Two Means
For this lesson, we will consider a difference in two
population means, 1 2, under the condition that
the data are not paired.
For instance, a teacher might like to test the notion
that two versions of an exam were equally difficult.
He could do so by randomly assigning each
version to students.

2
Difference of Two Means
If he found that the average scores on the exams
were so different that he cannot write it off as
chance, then he may want to award extra points to
students who took the more difficult exam.
The teacher would like to evaluate whether there is
convincing evidence that the difference in average
scores between the two exams is not due to
chance.

3
Point Estimates
To start, the teacher would need a "best guess" for
the differences, based on the sample data. This
"best guess" is called the point estimate:

x1 x2 is a point estimate for 1 2

4
Conditions for Inference
The t distribution can be used for inference when
working with the standardized difference of two
means if the following two conditions are met.

1) Each sample meets the conditions for using the


t distribution (independence and nearly normal
data).
2) The samples are independent of each other.

5
Conditions for Inference
For instance, if the teacher believes students in his
class took the test independently of each other,
exam scores followed a normal distribution, and
the two groups of students taking the different
versions of the exam were unpaired, then we can
use the t distribution for inference on the point
estimate x1 x2 .

6
Standard Error
The formula for the standard error of x1 x2 is
given below:

2 2
s s
SE x1 x2 SE SE
2
x1
2
x2 1
2
n1 n2

7
Example 1
Calculate the standard error for the difference of
two means if the first sample had 21 observations
with a mean of 12.6 and standard deviation of 3.2.
and the second sample had 30 observations with a
mean of 17.8 and standard deviation of 4.1.

s12 s22
SE x1 x2 SE x21 SE x22
n1 n2

8
Degrees of Freedom
Because we will use the t distribution, we will need
to identify the appropriate degrees of freedom.
This can be done using either computer software
or a lot of free time:

2
s12 s22

df n1 n2
2 2
1 s12 1 s22

n1 1 n1 n2 1 n2
9
Degrees of Freedom
(Modified)
An alternate formula (and the one we will use) is to
use the smaller of n1 1 and n2 1, which is the
method we will apply in the examples and exercises.

df the smaller of the sample sizes, minus one

Although the modified formula will result in different


degrees of freedom from the actual formula, the
conclusion of a test will rarely be affected by the
choice.

10
Different Exams
Summary statistics for each exam version are
shown below. The teacher would like to evaluate
whether this difference is so large that it provides
convincing evidence that Version B was more
difficult (on average) than Version A.

Version n x s min max


A 30 79.4 14 45 100
B 27 74.1 20 32 100
11
Example 2
Construct a two-sided hypothesis test to evaluate
whether the observed difference in sample means,
x A xB 79.4 74.1 5.3, might be due to
chance.
That is, write the hypotheses to test whether the
two sample means are different from each other.

Version n x s min max


A 30 79.4 14 45 100
B 27 74.1 20 32 100
12
Example 3
a) Does it seem reasonable that the scores are
independent within each group?
b) Does it seem reasonable that the distribution of
each group is approximately normal?
c) Do you think scores from the two groups would be
independent of each other (i.e. the two samples
are independent)?

Version n x s min max


A 30 79.4 14 45 100
B 27 74.1 20 32 100
13
Example 4
Compute the standard error for the point estimate.

2 2
s s
SE x1 x2 SE SE
2
x1
2
x2 1 2
n1 n2

Version n x s min max


A 30 79.4 14 45 100
B 27 74.1 20 32 100
14
Example 5
Next, construct the test statistic.

point estimate null value


T
SE

Version n x s min max


A 30 79.4 14 45 100
B 27 74.1 20 32 100
15
Example 6
Identify the p-value, as shown in the figure. and
provide a conclusion in the context of the case study?

Version n x s min max


A 30 79.4 14 45 100
B 27 74.1 20 32 100
16
Example 7
The actual degrees of freedom are approximately
df = 45.9726, giving a p-value of 0.25728. How does
our calculation of the p-value in the previous example
compare?

Version n x s min max


A 30 79.4 14 45 100
B 27 74.1 20 32 100
17
Baby Smoke
The data set below represents a random sample of
150 cases of mothers and their newborns in North
Carolina over a year. Four cases from this data set
are represented in the table below. The value "NA",
shown for the first two entries of the first variable,
indicates that piece of data is missing.

fAge mAge weeks weight sexBaby smoke


1 NA 13 37 5.00 female nonsmoker
2 NA 14 36 5.88 female nonsmoker
3 19 15 41 8.13 male smoker

150 45 50 36 9.25 female nonsmoker 18
Baby Smoke
We are particularly interested in two variables:
weight and smoke. The weight variable represents
the weights of the newborns and the smoke
variable describes which mothers smoked during
pregnancy.

fAge mAge weeks weight sexBaby smoke


1 NA 13 37 5.00 female nonsmoker
2 NA 14 36 5.88 female nonsmoker
3 19 15 41 8.13 male smoker

150 45 50 36 9.25 female nonsmoker 19
Baby Smoke
We would like to know if there is convincing
evidence that newborns from mothers who smoke
have a different average birth weight than
newborns from mothers who don't smoke. We will
use the North Carolina sample to try to answer this
question.
fAge mAge weeks weight sexBaby smoke
1 NA 13 37 5.00 female nonsmoker
2 NA 14 36 5.88 female nonsmoker
3 19 15 41 8.13 male smoker

150 45 50 36 9.25 female nonsmoker 20
Baby Smoke
The top histogram
represents birth weights
for infants whose mothers
smoked. The bottom
histogram represents the
birth weights for infants
whose mothers who did
not smoke. Both
distributions exhibit strong
skew.

21
Example 8
Use NS S as the parameter to set up appropriate
hypotheses to evaluate whether there is a relationship
between a mother smoking and average birth weight.
Use the summary statistics below and make sure to
check the conditions.

smoker nonsmoker
x 6.78 7.18
s 1.43 1.60
n 50 100
22
Example 9
Given our conclusion, could we have made a Type
1 or a Type 2 Error?
What could we have done differently in data
collection to be more likely to detect such a
difference?

23
Summary for Inference of
the difference of two means
When considering the difference of two means,
there are two common cases: either the two
samples are paired or they are independent.
When applying the normal model to the point
estimate xx1 x2 (corresponding to unpaired data),
it is important to verify conditions before applying
the inference framework using the normal model.

24
Summary for Inference of
the difference of two means
First, each sample mean must meet the conditions
for normality: independent observations and not
too much skew (This second condition can be
relaxed as the sample sizes increase.)
Second, the samples must be collected
independently (e.g. not paired data).
When these conditions are satisfied, the general
tools of inference may be applied.

25
Two Sample Tests from
Start to Finish
1) Verify you have data from two samples that are
independent of each other.
2) State the hypotheses using 1 2.
3) Check the independence and normality conditions
for each sample.
4) Calculate the point estimate and standard error:

s12 s22
Pt. Est. x1 x2 SE x1 x2
n1 n2
continued
26
Two Sample Tests from
Start to Finish
5) Calculate the test statistic using
point estimate null value x1 x2 0
T
SE SE x1 x2

6) Calculate the p-value. Use df = the smaller of the


sample sizes, minus 1.
For left-tail tests, use tcdf(999, T, df)
For right-tail tests, use tcdf(T, 999, df)
For two-tail tests, use tcdf(|T|, 999, df) 2

continued
27
Two Sample Tests from
Start to Finish
7) Compare the p-value to and make a conclusion.
If p-value < , then this would be considered
enough evidence to reject H0.
If p-value , then this would be considered
insufficient to reject H0.

28

You might also like