Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
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:
4
1 2 1 2 is a point estimate for x x
Conditions for Inference
The t distribution can be used for inference when
working with the standardized difference of two
means if
1) each sample meets the conditions for using the
t distribution (independence and nearly normal
data) and
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
6
1 2.x x
Standard Error
The formula for the standard error of is
given below:
7
1 2x x
1 2 1 2
2 22 2 1 2
1 2x x x x
s sSE SE SE
n n
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:
22 21 2
1 2
2 22 21 2
1 1 2 2
df
1 1
1 1
s s
n n
s s
n n n n
8
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.
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.
df the smaller of the sample sizes, minus one
9
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.
10
Version n s min max
A 30 79.4 14 45 100
B 27 74.1 20 32 100
x
Example 1
Construct a two-sided hypothesis test to evaluate
whether the observed difference in sample means,
, might be due to
chance.
That is, write the hypotheses to test whether the
two sample means are different from each other.
11
79.4 74.1 5.3A Bx x
Version n s min max
A 30 79.4 14 45 100
B 27 74.1 20 32 100
x
Example 2
a) Does it seem reasonable that the scores are
independent within each group?
b) Does it seem reasonable to 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)?
12
Version n s min max
A 30 79.4 14 45 100
B 27 74.1 20 32 100
x
Example 3
Compute the standard error for the point estimate.
13
1 2 1 2
2 22 2 1 2
1 2x x x x
s sSE SE SE
n n
Version n s min max
A 30 79.4 14 45 100
B 27 74.1 20 32 100
x
Example 4
Next, construct the test statistic.
14
point estimate null valueT
SE
Version n s min max
A 30 79.4 14 45 100
B 27 74.1 20 32 100
x
Example 5
Identify the p-value, as shown in the figure. and
provide a conclusion in the context of the case study?
15
Version n s min max
A 30 79.4 14 45 100
B 27 74.1 20 32 100
x
Example 6
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?
16
Version n s min max
A 30 79.4 14 45 100
B 27 74.1 20 32 100
x
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.
17
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
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.
18
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
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.
19
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
Baby Smoke
The top histogram
represents birth weights
for infants whose
mothers smoked. The
bottom panel represents
the birth weights for
infants whose mothers
who did not smoke.
Both distributions
exhibit strong skew.
20
Example 7
Use μn – μ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.
21
smoker nonsmoker
6.78 7.18
1.43 1.60
50 100
x
s
n
Example 8
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?
22
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 x (corresponding to unpaired data),
it is important to verify conditions before applying
the inference framework using the normal model.
23
1 2x x
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.
24
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:
25
continued
1 2
2 2
1 2
1 2x x
s sSE
n n 1 2Pt. Est. x x
Two Sample Tests from
Start to Finish
5) Calculate the test statistic using
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
26
1 2
1 2 0point estimate null value
x x
x xT
SE SE
continued
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.
27