Test Statistic

advertisement
PSY 2010 Corty - Ch 10:
Analysis of Variance
Situation
We wish to compare the means of THREE or more groups.
Example.
Suppose we are studying the effects of three different antibiotics for treatment of C. Difficile
infection.
Ironically, C. Difficile (C.Diff) is most often caused by the patient having taken an antibiotic for
some other condition. That antibiotic killed the bacteria that normally keep C.Diff in check. But
the appropriate treatment is another antibiotic – one that targets C.Diff. The issue is, “Which
one?”
Suppose that three C.Diff-targeting antibiotics have been proposed by different pharmaceutical
companies – A, B, and C. Suppose that a small scale study is proposed to see if there are any
large differences in the effects of the three on the number of C.Diff bacteria.
Thirty patients each are identified at a group of hospitals, all
of whom have been diagnosed with C.Diff. The first 10
patients are given antibiotic A. The second group of 10 is
given antibiotic B. The third group of 10, you guessed it, is
given antibiotic C.
After 14 days, let’s suppose that a standardized count of
number of bacteria present is taken from each patient. This
standardized count is on a scale of 0 to 100, with 0
representing complete absence of the C.Diff and 100
representing the greatest proportion of C.Diff possible. (The
actual measures taken are more complicated than this.) Note
that for many people there are always C.Diff bacteria present.
The issue is that for most people there are not enough present
to cause difficulty. They are kept in check by other, nonharmful bacteria. So the goal of treatment is to get the count
of C.Diff down sufficiently that the C.Diff will not create
future problems.
The hypothetical data are presented here. . . (The red bars
were added to help you identify the groups.) Suppose that the
average of the count variable was 60 prior to treatment.
Biderman’s P2010
One Way Analysis of Variance - 1
2/9/2016
The inferential situation
Group 1 is a sample from a population of persons with C.Diff who could have been given
antibiotic A.
Group 2 is a sample from a population who could have been given B.
Group 3 is a sample from the antibiotic C population.
First question to answer
Are the means of the count variable equal in the three populations.
We begin with the null:
Means of the three populations are equal.
Our alternative is:
Means of the three populations are not equal.
Note: The null, as always, is about the populations, not the sample.
Implications of the hypothesis test.
If the population means are not different, the implication is that any of the antibiotics will work
just as well as either of the others.
But if the null is rejected, then there are differences in the efficacy of the antibiotics.
Biderman’s P2010
One Way Analysis of Variance - 2
2/9/2016
Test Statistic: F Statistic
Equal sample size formula
Common Sample size * Variance of Means
F = ----------------------------------------------------Mean of Sample variances
where
n
K
S2X-bar
S2i
=
=
=
=
common sample size
No. of means being compared
Variance of sample means.
Variance of scores within group i
Unequal Sample Size formula
where
ni = No. of scores in group i
N
=
n1 + n2 + . . . + nK = Total no. of scores observed.
X-bar=
Mean of all the N scores.
Numerator df
= K-1
Denominator df = N - K
Luckily, we will not have to compute any of these by hand. We will have the
computer do it for us.
Biderman’s P2010
One Way Analysis of Variance - 3
2/9/2016
More Than You Ever Wanted to Know about F
The F statistic compares the variability of the sample means with the variability of individual
scores within the samples.
Because it is a comparison of variability, it’s called the Analysis Of Variance, or ANOVA.
ANOVA was first used by Ronald Fisher, a British Mathematician, in the 1930s.
The theory underlying F is beautiful. But it requires far more knowledge of mathematics than
necessary for this course. So we’ll skip the theory for this semester.
Values of Fexpected if the Null Hypothesis is true
The F statistic can take on only positive values.
So if you see a negative value of F, something is wrong.
If the null hypothesis of no difference in population means is true, the value of F should
be about equal to 1.
Values of F expected if the Null is false
If the null is false, F should be larger than 1.
After the fact (Post hoc) tests conducted if the null is false.
If the null is false, a natural question to ask is, “Well, if the means are not equal, which means
are different from which?”.
This question has led statisticans to develop what are called Post Hoc tests.
These tests are carried out and referred to when the null hypothesis has been rejected.
Obviously, if the null (that the population means are equal) is retained, there is no need to ask,
“Which means are different from which?” because they’re NOT different.
Biderman’s P2010
One Way Analysis of Variance - 4
2/9/2016
Working out our problem in SPSS . . .
Recall the data . . .
Count is the standardized count of number of C.Diff bacteria
after 14 days.
Condit is the antibiotic condition
1=A
2=B
3=C
There are 10 patients per condition.
Biderman’s P2010
One Way Analysis of Variance - 5
2/9/2016
The One-Way ANOVA dialog box.
There are a TON of Post Hoc tests from which to choose.
I prefer the Tukey’s-b test. We’ll use that here.
I’ll ask you to use Tukey’s-b for all of your submissions to me.
Biderman’s P2010
One Way Analysis of Variance - 6
2/9/2016
Options you should take . . .
Always take the opportunity to get
1) Descriptive statistics, and
2) a visual display of your analysis.
The results
Descriptives
count
95% Confidence Interval for Mean
N
Mean
Std. Deviation
Std. Error
Lower Bound
Upper Bound
Minimum
Maximum
1A
10
9.00
3.266
1.033
6.66
11.34
4
14
2B
10
15.10
3.604
1.140
12.52
17.68
9
19
3C
10
17.50
5.662
1.790
13.45
21.55
8
24
Total
30
13.87
5.526
1.009
11.80
15.93
4
24
Biderman’s P2010
One Way Analysis of Variance - 7
2/9/2016
ANOVA
count
Sum of Squares
df
Mean Square
Between Groups
384.067
2
192.033
Within Groups
501.400
27
18.570
Total
885.467
29
F
Sig.
10.341
.000
The F value is MUCH larger than 1, suggesting that the null is false.
The p-value is zero to 3 decimals places, much less than .050.
So the chances of getting such large differences between sample means if the population means
were equial are nearly 0.
This suggests we should reject the null hypothesis.
Post Hoc Tests
Homogeneous Subsets
Reading the Post Hoc results . . .
count
Tukey Ba
1. Means of groups in different columns are
significantly different.
Subset for alpha = 0.05
condit
N
1
2
2. Means of groups in the same column are
NOT significantly different.
1A
10
9.00
2B
10
15.10
3C
10
17.50
Means for groups in homogeneous subsets are displayed.
a. Uses Harmonic Mean Sample Size = 10.000.
Means Plots
So the mean, 9.00, is significantly different from
15.10 and from 17.50.
But 15.10 and 17.50 are NOT significantly
different from each other.
So it appears that antibiotic A works best.
Biderman’s P2010
One Way Analysis of Variance - 8
2/9/2016
Working out our problem in Excel . . .
Excel does NOT follow the convention used by all other statistical packages that all values
to be analyzed are in the same column. Instead, it’s easiest in Excel to put the values in
adjacent columns of the Excel Spreadsheet . . .
The Excel Results . . .
Note that no Post Hoc tests are available in Excel.
Biderman’s P2010
One Way Analysis of Variance - 9
2/9/2016
Completing the Corty Hypothesis Testing Answer Sheet . . .
Give the name and the formula of the test statistic that will be employed to test the null
hypothesis.
One-Way Analysis of Variance
Check the assumptions of the test
Distributions appear to be approximately US within each group.
Null Hypothesis:________________________________________________________________
Means of the three populations are equal.
Alternative
Mean of the three populations are not equal
Hypothesis:______________________________________________________________
What significance level will you use to separate "likely" value from "unlikely" values of the test
statistic?
Significance Level = _________________.05_______________________________________
What is the value of the test statistic computed from your data and the p-value?
F = 10.341
p-value = .000 (from SPSS output) f
What is your conclusion?
Do you reject or not reject the null hypothesis?
Reject the null. p-value is less than .050.
What are the upper and lower limits of a 95% confidence interval appropriate for the problem?
Present them in a sentence, with standard interpretive language.
Confidence intervals are not required for problems involving 3 or more populations.
State the implications of your conclusion for the problem you were asked to solve. That is, relate
your statistical conclusion to the problem.
There are significant differences in mean bacteria counts between the three antibiotics.
Results of Post Hoc tests suggest that antibiotic A works best.
Biderman’s P2010
One Way Analysis of Variance - 10
2/9/2016
One Way Analysis of Variance: Second Worked Out Example
Problem
A professor teaches the same class to students from three different populations. The first is
a population of "regular" day students. The second is a population of students attending at night.
The third is a population of students working for a large corporation and meeting in a room
provided by the corporation. The same test is given to all three classes. The professor wonders
whether the mean final exam performance of students in the three populations will be equal.
Statement of Hypotheses
H0: µ1 = µ2 = µ3.
H1: At least 1 inequality.
Test statistic
F statistic for the One-Way Analysis of Variance.
Data
Regular:
58 69 67 80 91 86 94
Night:
79 89 93 96 83 90 99
Corporate: 72 85 89 75 79 80 94
Summary statistics
Group
Regular
Night
Corporate
Mean
77.86
89.86
82.00
SD
13.51
7.03
7.79
Variance of the sample means is 6.0952 = 37.149
Conclusion, worked out by hand. (Children – don’t try this at home.)
7*6.0952
F = ------------------------------ =
(13.5082+7.0342+7.7892)
--------------------------3
260.043
---------------------------- = 2.666
97.537
The following shows how SPSS was used to conduct the analysis.
The SPSS output reports the p-value associated with the F statistic.
Biderman’s P2010
One Way Analysis of Variance - 11
2/9/2016
One way analysis of variance using SPSS
Analyze -> Compare Means -> One-Way ANOVA
Put the name of the
variable being analyzed
(the dependent variable) in
this box.
Put the name of the
variable which designates
the groups being compared
in this box.
Click on the Options button to
open the Options Dialog box.
Biderman’s P2010
One Way Analysis of Variance - 12
2/9/2016
Oneway
De scriptiv es
95% Co nfide nce
Inte rval for M ean
SCORE CL ASS
Typ e
of class
Std .
Std .
De viatio n Error
13. 5084 5.1 057
1.0 0 Re gula r
N
7
Me an
77. 8571
2.0 0 Ni ght
7
89. 8571
7.0 339
3.0 0 Co rpora te
7
82. 0000
7.7 889
21
83. 2381
10. 6673
To tal
Lower
Bo und
65. 3640
Up per
Bo und
90. 3502
2.6 586
83. 3519
96. 3624
79. 00
99. 00
2.9 439
74. 7965
89. 2035
72. 00
94. 00
2.3 278
78. 3824
88. 0938
58. 00
99. 00
Min imum Ma ximu m
58. 00
94. 00
ANOVA
Su m of
Sq uares
52 0.095
df
2
Me an
Sq uare
26 0.048
Wi thin G roup s
17 55.71 4
18
97 .540
To tal
22 75.81 0
20
SCORE Be tween Gro ups
F
2.6 66
Sig .
.09 7
The F statistic is larger
than 1, but the p-value
says that we could have
gotten an F that big by
chance alone.
So we’ll retain the null
hypothesis of nodifferences between the
population means.
Means Plot
The plot makes it appear as
if there are huge differences
between the means.
But the authors of the
plotting algorithm adjust the
vertical axis scale to always
make the graph fill the plot.
So these apparently huge
differences are not
significant.
Biderman’s P2010
One Way Analysis of Variance - 13
2/9/2016
Completing the Corty Hypothesis Testing Answer Sheet . . .
Give the name and the formula of the test statistic that will be employed to test the null
hypothesis.
One-Way Analysis of Variance
Check the assumptions of the test
Distributions appear to be approximately US within each group.
Null Hypothesis:________________________________________________________________
Means of the three populations are equal.
Alternative
Mean of the three populations are not equal
Hypothesis:______________________________________________________________
What significance level will you use to separate "likely" value from "unlikely" values of the test
statistic?
Significance Level = _________________.05_______________________________________
What is the value of the test statistic computed from your data and the p-value?
F = 2.666
p-value = .097 (from SPSS output) f
What is your conclusion?
Do you reject or not reject the null hypothesis?
Retain the null. p-value is larger than .050.
What are the upper and lower limits of a 95% confidence interval appropriate for the problem?
Present them in a sentence, with standard interpretive language.
Confidence intervals are not required for problems involving 3 or more populations.
State the implications of your conclusion for the problem you were asked to solve. That is, relate
your statistical conclusion to the problem.
There are no significant differences in means of scores of the three groups of students.
No Post Hoc tests were computed because there were no significant differences.
Biderman’s P2010
One Way Analysis of Variance - 14
2/9/2016
Download