[R] Extracting case values from ancova adjusted means
B Jessop
anguillaphile at outlook.com
Wed Sep 9 02:11:06 CEST 2015
Dear Help List,
Given a standard one-way ANCOVA model for comparing k groups and with one covariate factor e.g. ANC <- lm(Y ~ X + Group) run within package "car" followed by the estimation of adjusted group means with the "effects" package e.g. Effects1 <- Effect("Group", ANC, se = TRUE) how can I extract the individual case values adjusted to the covariate grand mean that theoretically go into creating each adjusted group mean and its confidence interval? I recognize that summary computational formulae are probably used to estimate adjusted group means and their SE and the package "effects" may not even calculate individual case adjusted values. Use of the "fitted" command applied to the ANC model e.g. Fitted1 <- fitted(ANC) produces case values that do not average to the adjusted mean for each group output by "Effects" while applying "fitted" to the Effects output results in NULL. I am unsure why the first result occurs and the second outcome may result from having applied a command inappropriately. A function may need to be created to estimate case adjusted values but that is, at this time, beyond me. I have read the "effects" package pdf but found nothing to enlighten me on this issue. I have estimated adjusted case values in Excel using Yij(adj) = yij - b(xij - xbar) where b is the slope of the pooled Group regression and xbar is the grand mean X but the mean of the adjusted case values for a group do not always match the adjusted group means from the Effects or even the fitted command output as closely as I think they should (to at least 3 decimals given the data are log transformed) even after allowing for decimal rounding because I used only 5 places in Excel.
Thanks for any assistance in how to extract the case values used to create the adjusted group means from an ANCOVA by the "effects" package such that the mean of the case values for a group equals the adjusted mean for that group.
Regards,
B. Jessop
[[alternative HTML version deleted]]
More information about the R-help
mailing list