inferences about means - dalhousie university · 95% 1.960 99% 2.576 you have already calculated...
TRANSCRIPT
Inferences about Means
Keith Thompson
Department of Mathematics and StatisticsDepartment of Oceanography
February 23, 2012
( ) February 23, 2012 1 / 58
Information on the Instructor
Instructor Keith Thompson
Departments Statistics and Oceanography
Room 5635, 5th Floor Oceanography, LSC
E-mail [email protected]
Office hours 12:30-1:30pm MWF
(Chapter of Textbook) De Veaux et al. (Canadian Edition) February 23, 2012 2 / 58
Overview of Material1 Inferences about a Single Mean
Confidence Intervals: σ knownHypothesis Tests: σ knownThe t DistributionConfidence Intervals: σ not knownHypothesis Tests: σ not knownChoosing the Sample Size
2 Inferences about Two Means: Paired SamplesConfidence IntervalsHypothesis Tests
3 Inferences about Two Means: Independent SamplesConfidence IntervalsHypothesisTests
Good News: Not as much work as it appearsSame ideas used over and over
(Chapter of Textbook) De Veaux et al. (Canadian Edition) February 23, 2012 3 / 58
Chapters of the Textbook
Here’s a list of the chapters we’ll cover, along with approximate dates.Ignore sections marked ∗ in book.
Mar 2 Fri Inferences about µ Chapter 23Mar 5 Mon Inferences about µ Chapter 23Mar 7 Wed Inferences about µ Chapter 23Mar 9 Fri Inferences about µ1 − µ2 Chapter 25Mar 12 Mon Inferences about µ1 − µ2 Chapter 25Mar 14 Wed Inferences about µ1 − µ2 Chapter 24Mar 16 Fri Inferences about µ1 − µ2 Chapter 24
The chapter and topic will be shown at the bottom of each slide
(Chapter of Textbook) De Veaux et al. (Canadian Edition) February 23, 2012 4 / 58
Four Sure Ways to Boost Your Mark
1 Come to class I’ll expand on my notes in class, do more examples,and give info on what will be covered on the final exam
2 Read my notes ahead of class Even if you can only spend 10minutes, it will pay off
3 Print my notes and annotate them during class It’s a waste of timeto copy them down in class. Spend the time listening andunderstanding
4 Read the text book My notes are just a summary
(Chapter of Textbook) De Veaux et al. (Canadian Edition) February 23, 2012 5 / 58
Chapter 23
We will now focus on confidence intervals and hypothesis tests for asingle population mean µ.
Start with the simpler case of σ known to illustrate the basic ideas.
Then we’ll assume we don’t know σ, just the sample standarddeviation s. This will lead to a new distribution called the t distribution.
Let’s do an example to start.
How long does it take you to get to school?
A random selection of 40 Ontario students were asked how long ittakes to travel to school.
Time (in minutes)30 10 8 30 58 7 15 10 3515 10 25 22 2025 30 10 25 815 18 25 15 1025 5 2 5 2520 15 47 20 2013 20 5 15 2
Observations of a quantitative variable.Have units, correspond to "quantity"
Sample size is n = 40
The sample mean (y = 17.00) andstandard deviation (s = 9.66) arestatistics that summarize the sample
Suppose we are interested in the mean travel time of all Ontariostudents (not just the sample)? How do we construct confidenceintervals for this population mean, and test hypotheses about it?
(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 7 / 58
Inference: From Sample to PopulationLet’s illustrate the idea of inference with a simple schematic:
!
!
µ," !
!
!
y ,s!
Large green area correspondsto a population with mean µand standard deviation σ
Inner red area corresponds toa random sample with mean yand standard deviation s.
Our goal is to make inferences about the population (µ) from thesample (y and s). Over the next few classes you will learn how toconstruct confidence intervals and test hypotheses about µ.
(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 8 / 58
Sampling Distribution of y!
!
µ,"
!
!
!
y 2,s2 !
!
!
y 1,s1!
!
!
y 3,s3
!
Imagine repeatedly taking simplerandom samples (SRS) of size nfrom a population with mean µand standard deviation σ
The sample mean y will changewith each sample
Variability of the y is described byits sampling distribution
If population is normal then y ∼ N(µ, σ/√
n). Approximately true fornon-normal populations if n (and population size) are large enough(p486). Knowing the sampling distribution of y leads directly toconfidence intervals and test hypotheses.
(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 9 / 58
Confidence Intervals for µ When σ is Known
Sampling distributionof sample mean
µ
Circles: sample means of SRS drawnfrom normal populationSample means vary about µ accordingto sampling distribution of yRed lines show 90% confidenceintervals of the form y ±MEMargin of error (ME) chosen to ensurePr(CI covers µ)= 0.90
Given a SRS of size n from normal population with mean µ andknown standard deviation σ, a level C confidence interval for µ is
y ± z∗σ/√
n
where z∗ is the critical value obtained from the standard normal.
Approximate for non-normal populations if n (and population) large.(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 10 / 58
Three Important Critical Values
z*−z*
Confidence Level z∗
90% 1.64595% 1.96099% 2.576
You have already calculated confidence intervals, and used z∗ values,for population proportions (p, see p510 in text book). We are applyingexactly the same concepts and z∗ values to population means (µ).
(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 11 / 58
Example: How much does Tim weigh?Tim has weighed himself for years. Over relatively short periodshe’s found his weight is approximately normal with a standarddeviation of 3 pounds. Last month his measured weights were190.5, 189, 195.5 and 187 pounds. Find a 90% confidenceinterval for Tim’s mean weight last month.
We’re asked to find a 90% CI for µ, Tim’s mean weight last month.
Assume observations are SRS of size n = 4 from N(µ,3).
y =190.5 + 189 + 195.5 + 187
4= 190.5
For 90% confidence use z∗ = 1.645. This leads to following 90% CI
190.5± 1.645× 3/√
4 = 190.5± 2.5 = (188.0,193.0)
We are 90% confident that Tim’s mean weight last month was between188.0 and 193.0 pounds.
(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 12 / 58
Testing Hypotheses about µ When σ is Known
The logic is identical to testing hypotheses about proportions:
1 Define null hypothesis (e.g., H0 : µ = µ0)2 Define alternative hypothesis (e.g., HA : µ 6= µ0, HA : µ > µ0 )3 Calculate the test statistic assuming H0 true4 Find P-value (taking HA into account)5 If P-value< α, reject H0 in favor of HA
SRSs of size n from normal population with mean µ0 (i.e., H0 true)imply y ∼ N(µ0, σ/
√n). Thus if H0 true
y − µ0
SD(y)∼ N(0,1) SD(y) =
σ√n
This is the sampling distribution needed for step 4. Let’s summarizeusing a figure ...
(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 13 / 58
H0 : µ = µ0
HA : µ > µ0
zobs
H0 : µ = µ0
HA : µ < µ0
zobs
H0 : µ = µ0
HA : µ 6= µ0
zobs
!zobs
where the observed value of the test statistic is given by
zobs =y − µ0
σ/√
n
The P-value is the red shaded area. Note two sided HA means addingtwo tail areas. Let’s illustrate finding P-values and drawing conclusions.
(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 14 / 58
Example: Testing a hypothesis about Tim’s weightTim’s driver’s license give his weight as 188 pounds. Hashe gained weight? Test at the 0.1 significance level.
H0 : µ = 188HA : µ > 188
y − µ0
SD(y)=
190.5− 1883/√
4= 1.67
−3 −2 −1 0 1 2 3
zobs
=1.67z−score
Use Z-table to findP-value= Pr(Z>1.67)=0.048
P-value< α. Reject H0 in favor of HA. Conclude Tim’s gained weight.How would the results have changed if HA = µ < 0 and zobs = −1.96?
(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 15 / 58
Confidence Intervals and Hypothesis Tests
Confidence intervals and hypothesis tests are complementaryways of making inferences about µ.
They are both based on the sampling distribution of y .
Turns out that a level C confidence interval contains all the valuesof µ0 that would not be rejected using a two-sided HA andα = 1− C. (See p633)
Example: A confidence interval for Tim’s weightBased on Tim’s four weight measurement we are 90% confidentthat Tim’s mean weight last month was between 188 and 193pounds. What would you conclude if you were to test
H0 : µ = 190 versus HA : µ 6= 190H0 : µ = 186 versus HA : µ 6= 186
at the 10% significance level?(Chapter 23) Inferences About a Single Mean: σ known February 23, 2012 16 / 58
Mr William Gosset of the Guinness Brewery
So far we’ve assumed, for simplicity, that the populationstandard deviation σ is known.
In practice we usually don’t know σ, just the standarddeviation of the sample, s.
What do we do? Turns out we need to make onlyminor changes to our approach.
All we have to introduce a new type of distributionto account for the increased uncertainty (i.e., longer tailsof the distribution) that results from not knowing σ.
Good news: Underlying concepts are the same.You just have to focus on the details
Confidence Intervals for µ When σ is Unknown
Let’s start with an example.
Example: The mean calorie content of yogurtConsumer Reports tests a SRS of 14 tubs of a certain brand ofyogurt and measures the following calories per serving:
160 200 220 230 120 180 140130 170 190 80 120 100 170
Find a 95% confidence interval for the mean calorie content perserving of this brand of yogurt.
This question is very similar to the earlier questions about Tim’s weightexcept we don’t know the population standard deviation, σ.
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 18 / 58
A New Sampling Distribution
If the population standard deviation is known, we base confidenceintervals and hypothesis tests on
y − µSD(y)
where SD(y) = σ/√
n is the standard deviation of the sample mean.
When σ is unknown let’s simply replace it by the standard deviation ofthe sample (s) and use
y − µSE(y)
where SE(y) = s/√
n, the standard error of the sample mean.
If we knew the sampling distribution of (y − µ)/SE(y) we couldcalculate CIs, and test hypotheses, using the same logic as before.
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 19 / 58
The t Distribution
If a SRS of size n is drawn from a normal population with meanµ, then the one-sample t statistic
t =y − µs/√
n
has a t distribution with n − 1 degrees of freedom (df).
Properties of the t distribution:
There is a whole family of distributions, one for each n.Bell shaped, centered on zero and symmetric.The extra variability that comes from using s instead of σ causesthe t distribution to have longer tails than the standard normal.As n increases, the t distribution approaches the standard normal.
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 20 / 58
−3 −2 −1 0 1 2 3t
t2t10z (normal)
Note spread of t distribution decreases as df increases.
The equivalent of z∗ from the t distribution (t∗) will be much largerfor small n =⇒ wider confidence intervals (as expected).
P-values from the t distribution will also be much larger for small n=⇒ harder to reject H0 (as expected - and Gosset hoped, p620)
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 21 / 58
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 22 / 58
The One-Sample t-IntervalGiven a SRS of size n from population with unknown mean µ, alevel C confidence interval for µ is
y ± t∗n−1s√n
where t∗n−1 is critical value from the t distribution with n − 1 df.The interval is exact for normal populations, and approximatelycorrect for non normal populations if the sample size (andpopulation) are large enough (see assumptions on next slide).
Note confidence interval is the same form as before: y ±ME butthe margin of error is now t∗n−1SE(y) rather than z∗SD(y)
The critical t∗n−1 values depend on sample size and confidencelevel. In the final exam you will be expected to calculate t∗n−1 fromthe t-table at the back of the book.Find t∗n−1 for 95% CI with n = 5. What happens to t∗n−1 as n→∞?
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 23 / 58
Assumptions Behind One-Sample t-Intervals
Independence: Ideally the observations should be mutuallyindependent. This depends on how the data were collected. A SRSfrom a large population is ideal - this will ensure the observations arerepresentative and independent. Problems can arise if the sample sizeis comparable to the population size so we require the sample to beless than 10% of the population (the so-called 10% condition).
Normality: Problems arise with t-intervals if the sample size is smalland the population is not normal (e.g., strongly skewed). But as nincreases, we can tolerate larger deviations from normality (thedistribution of y approaches N(µ, σ/
√n), see p486). If n exceeds
about 40 you should be OK unless the sample is strongly skewed(p623). Important to examine the histogram of the sample, particularlywhen n is small to check it’s approximately unimodal and symmetric.
Make sure you read p622 to p624 of the textbook
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 24 / 58
Back to the yogurt example ...Consumer Reports tests a SRS of 14 tubs of a certain brand ofyogurt and measured the following calories per serving:
160 200 220 230 120 180 140130 170 190 80 120 100 170
Find a 95% confidence interval for the mean calorie content perserving of this brand of yogurt.
Let’s check the assumptions first.
Independence: We have a SRS from a large population soindependence assumption seems reasonable. 10% condition OK.
Normality: No evidence for strongdeviations from normality.
80 120 160 200
1
2
3
Calories of yogurt
Num
ber
of tu
bs
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 25 / 58
Here’s the information needed to find the 95% confidence interval:
n=14 Size of the sampley = 157.86 calories Mean of the samples = 44.75 calories Standard deviation of the sampledf=13 Degrees of freedom (n − 1)t∗n−1 = 2.160 95% critical t value (see slide 22)
y ± t∗n−1s√n
157.86 ± 2.160× 44.75/√
14157.86 ± 25.83
We are 95% confident the true mean calorie content of this brand ofyogurt is between 132.0 and 183.7 calories.
How would the interval change if we wanted 99% confidence?(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 26 / 58
Testing Hypotheses about µ when σ is unknown
Testing hypotheses about the yogurtConsumer Reports tests a SRS of 14 tubs of a certain brand ofyogurt and found the following numbers of calories per serving:
160 200 220 230 120 180 140130 170 190 80 120 100 170
Is the mean calorie content of this brand of yogurt greater than135 calories per serving? Test at α = 0.1.
The question calls for a hypothesis test (one-sample t-test for themean). Procedure is exactly the same as before (see slide 13).
The only difference is that we get the P-value from the t distributionrather than the standard normal. Let’s work through the example.
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 27 / 58
Same assumptions apply to one-sample t-tests as t-intervals. We’vealready seen the independence and normality assumptions are OK forthe yogurt example. Let’s carry out the test.
H0 : µ = 135HA : µ > 135
y − µ0
SE(y)=
157.86− 13544.75/
√14
= 1.91
−3 −2 −1 0 1 2 3tobs=1.91
t
Use t-table to find Pr(t13 > 1.91)
0.025<P-value<0.05
P-value< α so reject H0 in favor of HA and conclude mean caloriecontent of this brand of yogurt exceeds 135 calories per serving.
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 28 / 58
Confidence Intervals, Hypothesis Tests and MinitabLoad the yogurt data
MTB > set c1DATA> 160 200 220 230 120 180 140DATA> 130 170 190 80 120 100 170DATA> end
Calculate a 95% confidence interval
MTB > tinterval 95 c1Variable N Mean StDev SE Mean 95% CIC1 14 157.9 44.8 12.0 (132.0, 183.7)
Perform a hypothesis test at the 5% significance level
MTB > onet c1;SUBC> test 135;SUBC> alternative 1.Variable N Mean StDev SE Mean LB T PC1 14 157.9 44.8 12.0 136.7 1.91 0.039
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 29 / 58
Review of Hypothesis Tests and Type I Errors
Hypothesis testing can lead to two types of error:
H0 true H0 falseReject H0 Type I Error OK
Don’t reject H0 OK Type II Error
In a medical testing context, Type I errors are "false positives", andType II errors are false negatives.In a legal context, a Type I error is conviction of an innocentperson, and a Type II error is failure to convict a guilty person.Which error is most serious? Depends on context, point of view.Probability of a Type I error is controlled by α. We set it.Probability of a Type II error generally increases as α decreases.To decrease both, collect more data or evidence.
Read p567-568 and study Figure 21.3.(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 30 / 58
Choosing the Sample Size
Suppose that before collecting data you decide you need a confidenceinterval of a specific width, i.e., you know the margin of error.
The margin of error for a t-interval is
ME = t∗n−1s√n
Suppose we have a reasonable estimate of the standard deviation(e.g., run a small pilot study). We could then
1 Use the formula with t∗n−1 replaced by z∗ =⇒ first guess for n2 Using first guess for n, replace z∗ by t∗n−13 Solve again to update your estimate of n
The above scheme is only approximate but will give an idea of howlarge a sample is required. Let’s do an example.
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 31 / 58
A company claims its program downloads files quickly. You want toevaluate their claim with a 95% CI for the mean download time with amargin of error of 8 min. You think the standard deviation of downloadtimes is about 10 min. How many downloads must you make?
1 Use the formula with t∗n−1 replaced by z∗ to get first guess for nSubstituting z∗ = 1.96 (used for a 95% CI) for t∗n−1 we find
n =[t∗n−1
sME
]2=
[1.96
108
]2
= 6.00
2 Use this n to replace z∗ by t∗n−1 =⇒ t∗5 = 2.5713 Solve again for n
n =[t∗5
sME
]2=
[2.571
108
]2
= 10.33
To be safe, round up and conclude that you should test 11 files toget a 95% confidence interval for the true mean download timewith a margin of error of about 8 minutes.
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 32 / 58
A Couple of Examples to Discuss in Class
Class Example 1Twenty observations of width/length ratios (x1000) of rectanglesbeaded onto leather goods by Shoshoni Indians were recorded:693 662 690 606 570 749 672 628 609 844654 616 668 601 576 670 606 611 553 993
Prior experience has shown that such ratios are normally distributed.Find a 95% confidence interval for the mean ratio.
Class Example 2Six healthy sheep were injected with an antibiotic. The mean bloodserum concentration of the antibiotic after injection was of interest.
The 99% confidence interval was found to be (21.11,36.22).What are the sample mean and sample standard deviation?Using the sample mean and standard deviation, find theconfidence level of the interval (23.85,33.48).
(Chapter 23) Inferences About a Single Mean: σ unknown February 23, 2012 33 / 58
Chapter 25
We’ll now calculate confidence intervals and test hypotheses for thedifference in two population means.
This chapter focuses on the relatively simple case of "paired samples".
This allows us to use the main of the ideas of Chapter 23 with minimalchanges.
In the next chapter we’ll replace paired samples by independentsamples.
Inferences About Two Means!
!
µ1,"
1
!!
!
y 1,s1,n1
!
!
µ2,"
2
!
!
!
y 2,s2,n
2 !
So far we have made inferences about a single population mean, µ.
Focus now shifts to the differences in two population means, µ1 − µ2.
Start by assuming the observations are naturally "paired". In thisspecial case n1 = n2 (we’ll relax later when we look at unpaired data).
Let’s do an example.(Chapter 25) Inferences about Two Means: Paired February 23, 2012 35 / 58
To study the enhancement of ESP by hypnosis, 15 studentswere asked to guess the symbol on 200 concealed ESP testcards (each with one of 5 shapes). For 100 trials the studentswere awake; for 100 trials they were hypnotized. Correctanswers out of 100 shown below.
Student ID Awake Hypnotized1 18 252 19 203 16 264 21 265 16 206 20 237 20 148 14 189 11 18
10 22 2011 19 2212 29 2713 16 1914 27 2715 15 21
15
20
25Awake Hypno
Does hypnotism increases ESP?Not really convincing based onboxplots. Can we do better?
(Chapter 25) Inferences about Two Means: Paired February 23, 2012 36 / 58
Treating the Observations as Paired
Let’s look at the differences. In this way we can eliminate the variabilityfrom person to person and focus on the effect of hypnotism.
Student ID Awake Hypnotized dH−A1 18 25 72 19 20 13 16 26 104 21 26 55 16 20 46 20 23 37 20 14 -68 14 18 49 11 18 7
10 22 20 -211 19 22 312 29 27 -213 16 19 314 27 27 015 15 21 6
−8 −6 −4 −2 0 2 4 6 8 10 12
1
2
3
Hypnotized−Awake
Fre
quen
cyVery strong evidence in favor ofhypnotism increasing ESP.
(Chapter 25) Inferences about Two Means: Paired February 23, 2012 37 / 58
Let µ1, µ2 denote the mean number of correct responses (out of 100)of all hypnotized and awake students respectively.
Denote difference in population means by µd = µ1 − µ2. Nowdifference the observations in exactly the same way as the populationmeans. Two sample problem just turned into a one sample problem
Three assumptions must be satisfied to calculate a CI for µ1 − µ2:
1 Paired Data: The data must be paired. Examples include weightsbefore and after diet, pollution levels upstream and downstream ofpaper mills on rivers, age differences of husband and wife.
2 Independence: The differences must be independent (or close toindependent). One way is to select the individuals as a SRS froma large population.
3 Normality: The population of differences must be close to normalfor small n. (Check histogram of differences as above.) As nincreases assumption of normality becomes less important.
(Chapter 25) Inferences about Two Means: Paired February 23, 2012 38 / 58
Paired t-Interval for µ1 − µ2
If the 3 assumptions are justified, the confidence interval forµ1 − µ2 is given by
d ± t∗n−1sd√
n
where d and sd are the sample mean and standard deviation ofthe differences, n is the number of differences, and t∗n−1 is thecritical value from the t distribution with n − 1 df.
For the ESP example we have d = 2.87, sd = 4.14, n = 15. For a 95%confidence interval t∗14 = 2.145 =⇒ the CI is 2.87± 2.29.
I am 95% confident that ESP scores are, on average, higher bybetween 0.58 and 5.16 if the subject is hypnotized.
(Chapter 25) Inferences about Two Means: Paired February 23, 2012 39 / 58
If the 3 assumptions are justified, we can test hypotheses as before:
H0 : µd = ∆0
HA : µd > ∆0
tobs
H0 : µd = ∆0
HA : µd < ∆0
tobs
H0 : µd = ∆0
HA : µd 6= ∆0
tobs−tobswhere the observed value of the test statistic is given by
tobs =d −∆0
sd/√
n
Hypothesis tests and ESP
For ESP example HA : µd > 0, tobs = 2.87/(4.14/√
15) = 2.683
From the t-table, 0.005<P-value<0.01. Conclusion if α = 0.01?
(Chapter 25) Inferences about Two Means: Paired February 23, 2012 40 / 58
Example: Performance of tires when it’s wetA tire manufacturer wants to assess the performance of one of itsbrands of tires on wet surfaces. On a test track, a car made repeatedstops from a speed of 100 km/hour. The test was done on both dryand wet surfaces with the following stopping distances (in feet):
Tire 1 2 3 4 5 6 7 8 9 10Dry 145 152 141 143 131 148 126 140 135 133Wet 211 191 220 207 198 208 206 177 183 223
Find a 95% confidence interval for the mean increase in stoppingdistance due to a wet surface.
In this example the observations from the two populations are naturallypaired (associated with a particular tire). Let’s calculate a pairedt-interval. What are the parameters of interest? Assumptions hold?
(Chapter 25) Inferences about Two Means: Paired February 23, 2012 41 / 58
Tire 1 2 3 4 5 6 7 8 9 10Dry 145 152 141 143 131 148 126 140 135 133Wet 211 191 220 207 198 208 206 177 183 223d 66 39 79 64 67 60 80 37 48 90
n=10 Size of the sample of differencesd = 63 feet Mean of the differencessd = 17.59 feet Standard deviation of the differencesdf=9 Degrees of freedom (n − 1)t∗n−1 = 2.262 95% critical t value from table
d ± t∗n−1s√n
63.00 ± 2.262× 17.59/√
1063.00 ± 12.59
We’re 95% confident that the tire’s mean stopping distance in the wetis between 50.41 and 75.59 feet longer than in the dry.
(Chapter 25) Inferences about Two Means: Paired February 23, 2012 42 / 58
Notes on Paired Samples
Data pairing is an opportunity and you should take advantage of it.
Assumptions: (i) data are paired, and their differences are (ii)independent, (iii) from normal population (less important as n ↑).
Calculate confidence intervals and test hypotheses in exactly thesame way as the one sample case - just work with the differences.
Can use the same approach as above to estimate sample sizeneeded to get a margin of error (here ME = t∗n−1sd/
√n).
(Chapter 25) Inferences about Two Means: Paired February 23, 2012 43 / 58
Chapter 24
We just assumed the data from the two samples were paired.
Often this is not the case. Often n1 6= n2.
What do we do? Turns out we need to make only minor changes to ourapproach.
We will assume the samples are independent and modify the teststatistic to allow for the possibility n1 6= n2 and σ1 6= σ2.
Good news: The underlying concepts are the same as the one-sampleand paired cases. You just have to focus on the details.
Comparing Means with Independent Samples
Did Agent Orange Cause Cancer in Vietnam Vets?Vietnam vets are concerned about the carcinogenic effects of AgentOrange, a dioxin-laced herbicide sprayed on South Vietnam between1962 and 1979. Researchers from the Center for Disease Controlcompared dioxin levels of 646 living vets to the dioxin levels of 97 vetsof about the same age who did not serve in Vietnam. Are mean dioxinlevels higher for Vietnam vets compared to non-Vietnam vets?
•What are the populations and what is the parameter of interest?
• Is this randomized controlled experiment?
•What confounding variables may be present?
• Boxplots show reasonably normal distributions but with a few outliersamongst the Vietnam vets with very high dioxin levels. Cause?
The data are not paired. What do we do?
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 45 / 58
Here are the sample means, standard deviations and sample sizes ofthe veterans’ data from each population.
Vietnam Not Vietnamy 4.260 4.186s 2.643 2.302n 646 97
y1, s1 and n1: sample mean, standarddeviation and size for Vietnam vets.
y2, s2 and n2: corresponding valuesfor the non-Vietnam vets.
To test for a difference in mean dioxin levels of the two populations,calculate the difference of the two sample means:
y1 − y2 = 4.260− 4.186 = 0.074 parts per trillion
How large a difference is required to conclude Vietnam vets havehigher dioxin levels? Must make assumptions about the populationsand how the data were collected.
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 46 / 58
Population Parameters and AssumptionsLet the mean of dioxin level of the Vietnam vet population be µ1, andthe mean of the non-Vietnam vet population be µ2. We are interestedin confidence intervals, and hypothesis tests, involving
µd = µ1 − µ2
We make three assumptions about the populations and the way thedata are collected:
1 Independence: Each sample is drawn independently from itspopulation (e.g., SRS from a large population).
2 Normality: The two populations must be close to normal for smalln1 or n2 (check histograms of each sample.) As n1 and n2increase, assumption of normality becomes less important.
3 Independent Groups: The two samples, one from eachpopulation, are independent of each other.
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 47 / 58
If these three assumptions hold, the sampling distribution of
t =y1 − y2 − (µ1 − µ2)
SE(y1 − y2)SE(y1 − y2) =
√s2
1/n1 + s22/n2
is approximately a t distribution with
df =(V1 + V2)2
V 21 /(n1 − 1) + V 2
2 /(n2 − 1)
where
V1 =s2
1n1
V2 =s2
2n2
Although the math looks intimidating, the idea is the same as before:use y1 − y2 to make inferences about µ1 − µ2 after scaling bySE(y1 − y2). The assumptions allow us to approximate the samplingdistribution of t =⇒ confidence intervals and hypothesis tests (p657).
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 48 / 58
If the 3 assumptions hold, the approximate sampling distribution leadsto the following confidence interval for µ1 − µ2:
Two-Sample t-Interval for µ1 − µ2
y1 − y2 ± t∗df
√s2
1/n1 + s22/n2
where t∗df is the critical value from the t distribution with df givenon previous slide.
Vietnam Not-Vietnamy 4.260 4.186s 2.643 2.302n 646 97V 0.0108 0.0546
y1 − y2 = 4.260− 4.186 = 0.074df = 136√
s21/n1 + s2
2/n2 = 0.2558
For a 95% confidence interval t∗136 ≈ 1.96 =⇒ the CI is 0.074± 0.501.
I’m 95% confident dioxin levels of Vietnam vets are, on average, higherby an amount between -0.427 and 0.575 ppt.
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 49 / 58
Two-Sample t-test for µd = µ1 − µ2
If the above 3 assumptions hold, we test hypotheses as before usingthe following steps and test statistic:
H0 : µd = ∆0
HA : µd > ∆0
tobs
H0 : µd = ∆0
HA : µd < ∆0
tobs
H0 : µd = ∆0
HA : µd 6= ∆0
tobs−tobs
tobs =y1 − y2 −∆0√s2
1/n1 + s22/n2
=4.260− 4.186− 0√
2.6432/646 + 2.3022/97= 0.2912
P-value for HA : µd > 0 is 0.3857 from normal approximation (>0.1from t-table). Conclusion about the Vietnam vets?
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 50 / 58
What if σ1 = σ2 as well? Pooled Two Sample Methods
Pooled t-Interval for µ1 − µ2
y1 − y2 ± t∗df sp√
1/n1 + 1/n2
where df = n1 + n2 − 2 and the pooled standard deviation is
sp =
√(n1 − 1)s2
1 + (n2 − 1)s22
n1 + n2 − 2
Pooled Hypothesis Test for µ1 − µ2
tobs =y1 − y2 −∆0
sp√
1/n1 + 1/n2
Calculate P-value from the t distribution with df = n1 + n2 − 2.
For more details see p669.(Chapter 24) Inferences about Two Means: Independent February 23, 2012 51 / 58
Example: Improving third grader’s reading abilityA teacher believes a new activity will improve third graders’ reading.She exposes 21 students to the activity for 8 weeks, and monitors acontrol group of 23 students (another class) who follow the normalcurriculum. All students are tested after 8 weeks. Find a 95% CI forthe mean improvement in reading ability due to the new activity.
Treatment Group Control Group24 61 59 46 42 33 46 3743 44 52 43 43 41 10 4258 67 62 57 55 19 17 5571 49 54 26 54 60 2843 53 57 62 20 53 4849 56 33 37 85 42
0 20 40 60 800
5
Treatment
0 20 40 60 800
5
Control
Design of study is an issue e.g., no randomization; classroom effect?(Chapter 24) Inferences about Two Means: Independent February 23, 2012 52 / 58
Group n y s VTreatment 21 51.476 11.007 5.770Control 23 41.521 17.149 12.786
y1 − y2 = 51.476− 41.521 = 9.955
df =(5.77 + 12.79)2
5.772/20 + 12.792/22= 37.9 ≈ 37√
s21/n1 + s2
2/n2 = 4.308
t∗df = 2.025
y1 − y2 ± t∗df
√s2
1/n1 + s22/n2
9.955 ± 2.025× 4.3089.955 ± 8.724
Conclusion: We’re 95%confident that the meanimprovement in reading dueto the new activity isbetween 1.23 and 18.68.
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 53 / 58
Confidence Intervals, Hypothesis Tests and Minitab
Assume data loaded into C1 (treatment) and C2 (control).
For a 95% confidence interval, and HA : µ1 6= µ2, at 5% level, usecommand below. (Use subcommands to change HA or α.)
MTB > TwoSample c1 c2.
Two-sample T for C1 vs C2
N Mean StDev SE MeanC1 21 51.5 11.0 2.4C2 23 41.5 17.1 3.6
Difference = mu (C1) - mu (C2) = 9.95
95% CI for difference: (1.23, 18.68)
T-Test of difference = 0 (vs not =): T= 2.31 P-Value = 0.027 DF = 37
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 54 / 58
Example to Discuss in Class
Class Example
To assess if the level of iron in the blood (µmol per litre) is the same forchildren with cystic fibrosis as healthy children, a SRS was selectedindependently for each population:
Child n1 y1 s1Healthy 9 18.9 5.9CF 13 11.9 6.3
Is there a difference in the population means? Test at α = 0.05.
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 55 / 58
Let’s assume σ1 = σ2. Let µ1 and µ2 denote the population means ofiron levels of healthy and sick children respectively, and µd = µ1 − µ2the difference in the two means.
H0 : µd = 0HA : µd 6= 0
The observed test statistic is given by
tobs =y1 − y2
sp√
1/n1 + 1/n2=
18.9− 11.96.14
√1/9 + 1/13
= 6.06
where
sp =
√(n1 − 1)s2
1 + (n2 − 1)s22
n1 + n2 − 2=
√8× 5.92 + 12× 6.32
20= 6.14
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 56 / 58
tobs−tobs
Sampling distribution of test statistic assumingH0 is true (no difference in mean iron levels ofhealthy and sick kids)Any test statistic in the red area is more in favorof HA than the one we obtained (tobs = 6.06)P-value is probability of getting a test statisticmore in favor of HA than observed, assuming H0is true (sum of two red areas for HA : µd 6= 0)
Our very large tobs means the P-value is very small (<0.01 based on"Two-tail probability" row of t-table).
So if H0 is true it’s very unlikely we’d ever get a test statistic greaterthan the one we calculated (y1 − y2 is too large). So given our veryunlikely test statistic (P-value very small) we reject H0.
P-value< α, reject H0
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 57 / 58
The End
(Chapter 24) Inferences about Two Means: Independent February 23, 2012 58 / 58