12 Anova
12 Anova
ANOVA
I could do three pair-wise t-tests, but this would increase my type I error So, instead I want to look at the pairwise differences all at once. To do this, I can recognize that variance is a statistic that lets me look at more than one difference at a time
The F-test
Is the difference in the means of the groups more than background noise (=variability within groups)?
Summarizes the mean differences between all groups at once.
The F-distribution
The F-distribution is a continuous probability distribution that depends on two parameters n and m (numerator and denominator degrees of freedom, respectively):
The F-distribution
The
2 between 2 within
~ Fn ,m
Today
While only comparing two means, ANOVA will give the same results as the normal ttest. However, it allows comparing multiple means and thus multiple groups (factor levels) as well as multiple factors simultaneously.
25 27 24 27 M = 26.8
29 33 38 36 M = 34.5
22 22 21 15 M = 19.7
30 32 32 32 M = 32.7
An ANOVA allows us to quantify how far apart the sample means must be before we are no longer willing to say they are all approximately equal.
Introduction to ANOVA
(3) Provides researchers with much greater flexibility in design and analysis of experiments.
(4) Multiple Forms Well look at the simplest: Single-factor, independent measures ANOVA
(a) experimental unit :object on which measurements take place. (a) factor: new name for the independent variable (b) independent measures: separate sample for each treatment (c) level: the intensity settings of a factor (d) treatment : specific combination of factor levels. Eg: Tyre quality study, Weekly production volume.
Can be multiple factors (IVs) and levels (variations) Expressed as factors x levels Therapist Experience
experienced (+) inexperienced (-)
Treatment treatment A
treatment B
tx A + exp tx B + exp
tx A + inexp tx B + inexp
Example of ANOVA
25 28 22
30 29 30
27 20 21
22 27 24
M = 25
M = 29.7
M = 22.6
M = 24.3
Does time of test affect scores? ANOVA uses variance to assess differences among the sample means
25 28 22
M = 25
30 29 30
M = 29.7
27 20 21
M = 22.6
22 27 24
M = 24.3
Treatment Effect: Differences are caused by treatments. Chance: Differences simply due to chance.
Forming an F-Ratio
(3) Finally, determine the variance due to the treatments alone by forming an F-Ratio. F = Variance Between-Treatments Variance Within-Treatments
Or in terms of sources
If no treatment effect exists, F = 1.00 If there IS some treatment effect, F > 1.00 ( but not automatically statistically significant)
k = number of treatment conditions (levels and factors). For independent-measures study, k = # of separate samples. n = number of scores in a treatment condition N = total number of scores in whole study (N = nk) T = sum of scores for each treatment condition G = sum of all scores in the study (Grand Total)
STEP 1: State the Hypothesis H0: m1 m2 m3 mk (k = number of factor levels) H1 : At least one m is different from the others
Tx1
Tx2
Tx3
Tx4
25 28
30 29
27 20
22 27
22
M = 25
30
M = 29.7
21
M = 22.6
24
M = 24.3
STEP 2: Locate the Critical region a = .05 Calculate dfbetween = k 1 Calculate dfwithin = N-k Calculate dftotal = N-1 Critical F will be provided for you dfbetween + dfwithin = dftotal (always!) Begin to fill in the Source Table (ANOVA Table)
Tx1 Tx2 Tx3
k = number of factor levels n = number of scores in a treatment condition N = total number of scores in whole study (N = nk) T = sum of scores for each treatment condition G = sum of all scores in the study (Grand Total)
Tx4
25 28 22
M = 25
30 29 30
M = 29.7
27 20 21
M = 22.6
22 27 24
M = 24.3
Basic ANOVA Table SS df MS SSbetween k-1 MSbetween SSwithin N-k MSwithin SStotal N-1
F F = Fobtained
STEP 3: Collect Data and Compute Sample Statistics SSbetween = (T2/n) (G2/N) SSwithin = SS inside each treatment = (SS1+SS2+SS3+...+SSk) SStotal = X2 (G2/N) or SSbetween + SSwithin MSbetween = SSbetween/dfbetween MSwithin = SSwithin/dfwithin F = MSbetween/MSwithin Fill in source table (ANOVA Table) *note: SSbetween + SSwithin = SStotal (always!)
n = # of scores in a tx condition N = total # of scores in whole study T = sum of scores for each tx condition G = sum of all scores in the study (Grand Total)
STEP 4: Make a Decision Given the Critical F-value (Fcritical ) - which will be provided - decide whether or not to reject the null. Fobtained < Fcritical --> Fail to reject Ho. Fobtained > Fcritical --> Reject Ho.
Use Appendix B page A-29 to find Fcritical
Bold-Faced = Fcritical for a = 0.01 Light-Faced Fcritical for a = 0.05 df-numerator = df-between df-denominator = df-within
Error Term
Error due to chance Does the treatment effect (difference among means) produce greater variability between groups than that expected by chance? The denominator in the F ratio
Example 1
A researcher is interested in whether class time affects exam scores. There are four different class times being examined:
Run an ANOVA, a= .05, to see if a significant difference exists between these treatments.
Example 1 DATA
Tx. 1 25 28 22 mean1=25 T1=75 SS1=18 n1=3 Tx. 2 30 29 30 mean2=29.67 T2=89 SS2=0.67 n2=3 X2 = 7893 G = 305 N = 12 Tx. 3 27 20 21 mean3=22.67 T3=68 SS3=28.67 n3=3 Tx. 4 22 27 24 mean4=24.33 T4=73 SS4=12.67 n4=3
k=
Example 1 Calculations
SSbetween = (T2/n) (G2/N) SSbetween = ((752/3)+(892/3)+(682/3)+(732/3))- (93,025/12) SSbetween=((5625/3)+(7921/3)+(4624/3)+(5329/3))-7752.083 SSbetween = (1875+2640.33+1541.33+1776.33)-7752.083 SSbetween = 7832.99 7752.083 SSbetween = 80.91 SSwithin = SS1+SS2+SS3+SS4 SSwithin = 18+.67+28.67+12.67 SSwithin = 60.01 SStotal = X2 (G2/N) OR SSbetween + SSwithin SStotal = 7893-7752.083 OR 80.91+ 60.01 SStotal = 140.92
Calculate Correction Factor CF = G2/N = (305)2/12 Find sum of squares and subtract CF to find SST
SST = (x12 + x22 + x32 + xk2 ) CF SSTr = (xj) 2 CF nj SSE = SST - SSTr
Example 2
A researcher is interested in whether a new drug affects activity level of lab animals. There are three different doses being examined: low, medium, large. Run an ANOVA, a= .05, to see if a significant difference exists between these doses.
Null Hypothesis: Alternative:
Example 2 DATA
Dose 1 (lo) 0 1 3 0 1 Dose 2 (med) 1 3 4 1 1 Dose 3 (hi) 5 8 6 4 7
X2 = G= N= k=
Example 2 Calculations
SSbetween = (T2/n) (G2/N) SSbetween = SSbetween= SSbetween = SSbetween = SSbetween = SSwithin = SS1+SS2+SS3+SS4 SSwithin = SSwithin = SStotal = X2 (G2/N) OR SSbetween + SSwithin SStotal = SStotal =
Problem 1
To test the significance of variation in the retail prices of a commodity in three principal cities, Mumbai, Kolkata and Delhi, four shops were chosen at random in each city and the prices who lack confidence in their mathematical ability observed in rupees were as follows: Mumbai : 16 8 12 14 Kolkata : 14 10 10 6 Delhi : 4 10 8 8 Do the data indicate that the price in the three cities are significantly different?
r-1
SS
blocks
Nc-r+1 N1
SS
error
SStotal
Problem 2
The following table gives the number of refrigerators sold by 4 salesmen in 3 months May, June, and July. Is there a significant difference in the sales made by the four salesmen? Is there a significant difference in the sales made during different months?
Month A
May June July 50 46 39
Salesmen B
40 48 44
C
48 50 40
D
39 45 39
ANOVA summary
A statistically significant ANOVA (F-test) only tells you that at least two of the groups differ, but not which ones differ.
Determining which groups differ (when its unclear) requires more sophisticated analyses to correct for the problem of multiple comparisons
Answer: because, at an error rate of 5% each test, this means you have an overall chance of up to 1-(.95)3= 14% of making a type-I error (if all 3 comparisons were independent) If you wanted to compare 6 groups, youd have to do 6C2 = 15 pairwise ttests; which would give you a high chance of finding something significant just by chance (if all tests were independent with a type-I error rate of 5% each); probability of at least one type-I error = 1-(.95)15=54%.