[R] correct lme syntax for this problem?

Matthew Keller
Mon, 08 Sep 2008 23:10:13 -0000

Hello all,

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
information.

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!

Matt


--
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder