[R] help with structuring random factors using lmer()

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Thu Aug 10 16:24:21 CEST 2006


probably you're looking for something like:

m1 <- lmer(weight ~ time + I(time^2) + (time + I(time^2) - 1 | id), 
data = dataset)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Simon Pickett" <S.Pickett at exeter.ac.uk>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, August 10, 2006 4:00 PM
Subject: [R] help with structuring random factors using lmer()


> Hi,
> I am an R beginner and having problems structuring my REML models. I 
> have
> a model with
> y=weight
> x1=time
> x2=timesquared
> id=individual identity
> I need to structure the model such that in the random effects there 
> is a
> constant intercept for all individuals but a separate individual 
> slope for
> both x1 and x2 (a coefficient score for every individual).
> m1<-lmer(weight~time+timesq+(1|id)+(timesq-1|id)+(time-1|id), 
> data=dataset)
> coef(m1)
> gives me nearly what I want except there isnt an individual 
> coefficient
> score for each individual for x2.
> Any suggestions very much appreciated.
> Simon Pickett
> s.pickett at exeter.ac.uk
>
>
>
> Simon Pickett
> PhD student
> Centre For Ecology and Conservation
> Tremough Campus
> University of Exeter in Cornwall
> TR109EZ
> Tel 01326371852
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list