[R-sig-ME] lmer2() syntax with natural cubic splines

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Wed Sep 12 13:50:16 CEST 2007


Dear lmer2() users,

I was wondering which is the appropriate `formula' syntax in the case 
I'd like to include a nonlinear time effect using natural cubic 
splines, with a diagonal covariance matrix for the random effects. In 
particular, in the following example

library(lme4)
library(splines)

fit1 <- lmer2(y ~ treat * ns(time, df = 7) + (ns(time, df = 7) | id), 
data = test.data)

`fit1' assumes an unspecified (8 by 8) covariance matrix for the 
random effects. How should I specify the formula argument such that 
the model assumes a diagonal 8 by 8 covariance matrix.

A solution I thought of is to include the output of `ns(time, df = 7)' 
as extra columns in `test.data' and use something like,

fit2 <- lmer2(y ~ treat * ns(time, df = 7) + (1 | id ) + (0 + time1 | 
id) +
    (0 + time2 | id) + (0 + time3 | id) + (0 + time4 | id) + (0 + 
time5 | id) +
    (0 + time6 | id) + (0 + time7|id), data = test.data)

where `time1, ..., time7' denote the output columns of `ns(time, df = 
7)'.

Is there a more efficient specification of `formula' in order to 
achieve the above.


Thans in advance for any hints.

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


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




More information about the R-sig-mixed-models mailing list