[R] correct lme syntax for this problem?
mckellercran at gmail.com
Tue Sep 9 01:10:13 CEST 2008
I am about to send off a manuscript and, although I am fairly
confident I have used the lme function correctly, I want to be 100%
sure. Could some kind soul out there put my mind at ease?
I am simply interested in whether a predictor (SPI) is related to
height. However, there are five different populations, and each may
differ in mean level of height as well as the relationship between SPI
and height. Thus, I also want to a) account for mean level differences
in height and b) check whether the relationship between height and SPI
is different between the groups. I hope this is sufficient
height, SPI, covariate1, and covariate2 are numeric. population is a
factor with 5 levels. Here are the steps I took:
summary(mod1 <- lme(height ~ SPI + covariate1 + covariate2, random = ~
SPI | population))
summary(mod2 <- lme(height ~ SPI + covariate1 + covariate2, random = ~
1 | population))
anova(mod1,mod2) #this checks whether there is evidence for IQ & SPI
being related differently between the 5 populations.
Is this correct? THANKS!
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
More information about the R-help