shirley zhang
2008-Jan-22 15:38 UTC
[R] anova function to test the difference between two coefficients in nlme package
Dear Dr. Bates, and R-help, I've tried the anova function to test the difference between two coefficients, as shown on page 225 of your book "Mixed Effects Models in S and S-Plus (Statistics and Computing)". When I type: anova( fm2BW.lme, L = c(TimeDiet2 = 1, TimeDiet3 = -1) ) I got the following error message: Error: unexpected '=' in "anova( fm2BW.lme, L = c(Time:Diet2 =" Could you tell me whether I miss anything?> sessionInfo()R version 2.6.0 (2007-10-03) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] nlme_3.1-85 loaded via a namespace (and not attached): [1] grid_2.6.0 lattice_0.16-5 Thanks, Shirley
shirley zhang
2008-Jan-22 16:00 UTC
[R] anova function to test the difference between two coefficients in nlme package
Dear Dr. Bates, and R-help, I just found the reason I got the error message is because I copied the code directly from the book. When I tried the code in "~\library\nlme\scripts" under the R installation directory like the following, I got the same answere as in the book. anova(fm2BW.lme, L = c("Time:Diet2" = 1, "Time:Diet3" = -1)) Now my question is instead of test the difference between two coefficients, can I use anova to test the significance of the sum of two coefficients, like anova(fm2BW.lme, L = c("Time:Diet2" = 1, "Time:Diet3" = 1)) Thanks, Shirley On Jan 22, 2008 10:38 AM, shirley zhang <shirley0818 at gmail.com> wrote:> Dear Dr. Bates, and R-help, > > I've tried the anova function to test the difference between two > coefficients, as shown on page 225 of your book "Mixed Effects Models > in S and S-Plus (Statistics and Computing)". > > When I type: anova( fm2BW.lme, L = c(TimeDiet2 = 1, TimeDiet3 = -1) ) > > I got the following error message: > > Error: unexpected '=' in "anova( fm2BW.lme, L = c(Time:Diet2 =" > > Could you tell me whether I miss anything? > > > sessionInfo() > R version 2.6.0 (2007-10-03) > i386-pc-mingw32 > > locale: > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United > States.1252;LC_MONETARY=English_United > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] nlme_3.1-85 > > loaded via a namespace (and not attached): > [1] grid_2.6.0 lattice_0.16-5 > > > Thanks, > Shirley >