March 28, 30 Return exam Analyses of covariance 2-way ANOVA Analyses of binary outcomes
Exam 1 Scores N = 23 75% Q % Median 83 25% Q1 74 Mean = 83.7 SD = A 89-89B 70-79C 30% of Grade 30% Exam 2 30% Assignments 10% Project
Analysis of Variance ANOVA simultaneously tests for difference in k means Y - continuous k samples from k normal distributions each size n i, not necessarily equal each with possibly different mean each with constant variance 2
Analyses of Covariance Comparing k means adjusting for 1 or more other variables (covariates) Uses –Randomized students to adjust for an imbalance among treatments in a baseline factor. –In observational studies controlling for a confounding factor –To throw light on the nature of treatment effects in a randomized study –Improve precision of estimated differences among treatments
Analyses of Covariance Comparing k means adjusting for 1 or more other variables (covariates) Compute adjusted (or least square) means. Sometimes called ANCOVA
Original Use Fisher (1941) the Y were yields of tea bushes in an experiment. But the luck of the draw, some treatments will have been allotted to a more productive set of bushes than other treatments Use as an adjustment variable the yields of the bushes in the previous year.
Adjusted Means Computation YBAR i = Mean of Y for group I XBAR i = Mean of X for group I XBAR = Mean of X for all groups combined =Regression slope of X with Y YBAR(A) i = Adjusted mean for group I YBAR(A) i = YBAR i – XBAR i – XBAR) Adjustment
Adjusted Means Computation Observations YBAR(A) i = YBAR i – XBAR i – XBAR) 1)If then adjusted mean equals unadjusted mean 2)If mean of X is same for all group then adjusted mean equals unadjusted mean
Adjusted Mean Interpretation The mean of Y for the group if the mean of X for the group was at the overall mean. Uses a model to make the mean of X the same for all groups What would the means have been if all groups had the same mean of X?
Example from TOMHS Compare 12-month visit mean serum cholesterol between diuretic group and placebo group. 12-mo Avg.Baseline Avg. Diuretic Placebo Diff: Note: Diuretic group started out with higher cholesterols so may want to adjust for this difference.
Computing the Adjusted Means 12-mo Avg.Baseline Avg. Diuretic Placebo Total227.0 =0.894Regression slope of 12-month cholesterol on baseline cholesterol YBAR(A) (Diur)= – (230.7 – 227.0) = – (3.7) = YBAR(A) (Plac)= – (224.9 – 227.0) = – (-3.7) =
SAS Code PROC GLM; CLASS group; MODEL chol12 = group cholbl/SS3 SOLUTION; MEANS group; LSMEANS group; ESTIMATE ‘Adjusted Mean Dif' group 1 -1; RUN;
SAS GLM Output Source DF Type III SS Mean Square F Value Pr > F GROUP cholbl <.0001 Standard Parameter Estimate Error t Value Pr > |t| Intercept B GROUP B GROUP B... cholbl <.0001 Regression slope SOLUTION
SAS GLM Output Level of CHOL cholbl GROUP N Mean Std Dev Mean Std Dev Least Squares Means CHOL12 GROUP LSMEAN Standard Parameter Estimate Error t Value Pr > |t| dif LSMEANS group; ESTIMATE 'dif' group 1 -1; dif
Two-Way ANOVA Two categorical factors related to a continuous outcome (Factor A and factor B). If factors are allocated randomly to all combinations of A and B then design called factorial design Questions asked –Overall is A related to Y –Overall is B related to Y –Does the effect of A on Y depend on level of B Example –A = Race; B = BP drug; Y = BP response –A = Vitamin E (y/n); aspirin use (y/n)
Factorial Design Example Aspirin + Vitamin E Aspirin + Placebo for Vitamin E Placebo for Aspirin + Vitamin E Placebo for Aspirin + Placebo for Vitamin E A = Aspirin use (yes or no) B = Vitamin E use (yes or no) Placebo for aspirin and placebo for Vitamin E
TOMHS Example Question: Do certain BP medications differ in lowering blood pressure in blacks compared to whites? Change in SBP (mm Hg) Diuretic Blocker Blacks Whites Difference Is the difference –2.2 significantly different from +9.1
SAS Code LIBNAME tomhs 'C:\my documents\ph5415\'; DATA temp; SET tomhs.bpstudy; * Choose diuretic and alpha blocker groups; * Variable black = 1 or 2; if group in(3,4); sbpdif = sbp12 - sbpbl; RUN; PROC GLM DATA=temp; CLASS black group; MODEL sbpdif = black group black*group; MEANS black*group; RUN; Tests for interaction
SAS OUTPUT The GLM Procedure Level of Level of sbpdif GROUP BLACK N Mean Std Dev
SAS OUTPUT The GLM Procedure Dependent Variable: sbpdif Sum of Source DF Squares Mean Square F Value Pr > F Model Error Corrected Total Source DF Type III SS Mean Square F Value Pr > F GROUP <.0001 BLACK GROUP*BLACK
Your Turn Using TOMHS data test