1 Analysis of Variance (ANOVA) EPP 245 Statistical Analysis of Laboratory Data
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 2 The Basic Idea The analysis of variance is a way of testing whether observed differences between groups are too large to be explained by chance variation One-way ANOVA is used when there are k ≥ 2 groups for one factor, and no other quantitative variable or classification factor.
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 3 ABC
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 4 Data = Grand Mean + Row Deviations from grand mean + Cell Deviations from row mean Are the row deviations from the grand mean too big to be accounted for by the cell deviations from the row means?
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 5 ABC Data
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 6 ABC Cell Means
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 7 ABC Deviations from Cell Means
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 8 Red cell folate data Description: 22 rows and 2 columns. data on red cell folate levels in patients receiving three different methods of ventilation during anesthesia. Format: folate a numeric vector. Folate concentration ( g/l). ventilation a factor with levels 'N2O+O2,24h': 50% nitrous oxide and 50% oxygen, continuously for 24 hours; 'N2O+O2,op': 50% nitrous oxide and 50% oxygen, only during operation; 'O2,24h': no nitrous oxide, but 35-50% oxygen for 24 hours.
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 9 insheet using redcell.csv summarize folate tabulate ventilation tabulate ventilation, summarize (folate) graph box folate, over (ventilation) graph export folate1.wmf oneway folate ventilation describe ventilation encode ventilation, generate(dv) Describe dv
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 10. summarize folate Variable | Obs Mean Std. Dev. Min Max folate | tabulate ventilation ventilation | Freq. Percent Cum N2O+O2,24h | N2O+O2,op | O2,24h | Total | tabulate ventilation, summarize (folate) | Summary of folate ventilation | Mean Std. Dev. Freq N2O+O2,24h | N2O+O2,op | O2,24h | Total |
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 11
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 12. oneway folate ventilation Analysis of Variance Source SS df MS F Prob > F Between groups Within groups Total Bartlett's test for equal variances: chi2(2) = Prob>chi2 = 0.351
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 13. describe ventilation storage display value variable name type format label variable label ventilation str10 %10s. encode ventilation, generate(dv). describe dv storage display value variable name type format label variable label dv long %10.0g dv. anova folate dv Number of obs = 22 R-squared = Root MSE = Adj R-squared = Source | Partial SS df MS F Prob > F Model | | dv | | Residual | Total |
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 14 Two- and Multi-way ANOVA If there is more than one factor, the sum of squares can be decomposed according to each factor, and possibly according to interactions One can also have factors and quantitative variables in the same model (cf. analysis of covariance) All have similar interpretations
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 15 Heart rates after enalaprilat Description: 36 rows and 3 columns. data for nine patients with congestive heart failure before and shortly after administration of enalaprilat, in a balanced two-way layout. Format: hr a numeric vector. Heart rate in beats per minute. subj a factor with levels '1' to '9'. time a factor with levels '0' (before), '30', '60', and '120' (minutes after administration).
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 16. drop _all. insheet using heart.rate.csv (4 vars, 36 obs). anova hr subj time Number of obs = 36 R-squared = Root MSE = Adj R-squared = Source | Partial SS df MS F Prob > F Model | | subj | time | | Residual | Total |
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 17
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 18
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 19. anova hr subj Number of obs = 36 R-squared = Root MSE = Adj R-squared = Source | Partial SS df MS F Prob > F Model | | subj | | Residual | Total | predict hrhat (option xb assumed; fitted values). generate hrres = hr - hrhat. graph box hrres, over (time). graph export hrresxtime.wmf
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 20
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 21. anova hr subj time Number of obs = 36 R-squared = Root MSE = Adj R-squared = Source | Partial SS df MS F Prob > F Model | | subj | time | | Residual | Total | rvfplot. graph export hrrvf.wmf. rvpplot subj. graph export hrrvpsubj.wmf. rvpplot time. graph export hrrvptime.wmf
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 22
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 23
November 2, 2006EPP 245 Statistical Analysis of Laboratory Data 24