[R] correct lme syntax for this problem?

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Sep 9 10:15:26 CEST 2008

Dear Matthew,

First of all I'm forwarding this to R-SIG-Mixed, which is a more
appropriate list for your question.
Using a mixed effect with only 5 levels is a borderline situation.
Douglas Bates recommends at least 6 levels in order to get a more or
less reliable estimate. So I would consider the populations as fixed
effects. Do you have repeated measurements of individuals within your
populations? If you do you could use those as random effects.

Your anova tests whether the variances of the random slope on SPI is
zero. I think you might want this:

mod1 <- lm(height ~ SPI * population + covariate1 + covariate2)
mod2 <- lm(height ~ SPI + population + covariate1 + covariate2)
anova(mod1, mod2)



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens Matthew Keller
Verzonden: dinsdag 9 september 2008 1:10
Aan: R Help
Onderwerp: [R] correct lme syntax for this problem?

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

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

R-help op r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in  this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.

More information about the R-help mailing list