Dear R-list, I?m trying to use the lmer of the lme4 package to fit a linear mixed model of the form Y = Xb + Zu + e and I can?t figure out how to control the covariance structure of u. I want u ~ N(0,sigma^2*I). More precisely I?m trying to smooth a curve through data using the "Penalized Splines as BLUPs" method as described in Ruppert, Wand & Carroll (2003). So I have Z = [Z1 Z2 ... Z11] where Z1,...,Z11 is a linear spline basis and X = [1 t] where t is time column in my case. I have tried various things and read a lot of the online literature but I can?t seem to find anything useful. I know the old way of fitting this using lme is: fit <- lme(y~-1+X,random=pdIdent(~-1+Z)) and then extracting the u vector with u.hat <- unlist(fit$coef$random) Is there anyone who could possibly help me and provide me with a code using the lmer? Is it possible to fit this using lmer without specifying the Z and the X matrix and instead just use the columns t and Z1, Z2, ..., Z11? Thanks in advance, Matthias ************************ Matthias Kormaksson, Ph.D Student, Department of Statistics, Cornell University
I think you want the random effects to be independent. If so then you need lmer(response ~ time +(time|id) + (time-1|id), data) Harold -----Original Message----- From: r-help-bounces@stat.math.ethz.ch on behalf of Matthias Kormaksson Sent: Thu 4/13/2006 4:04 PM To: r-help@stat.math.ethz.ch Cc: Subject: [R] Penalized Splines as BLUPs using lmer? Dear R-list, I´m trying to use the lmer of the lme4 package to fit a linear mixed model of the form Y = Xb + Zu + e and I can´t figure out how to control the covariance structure of u. I want u ~ N(0,sigma^2*I). More precisely I´m trying to smooth a curve through data using the "Penalized Splines as BLUPs" method as described in Ruppert, Wand & Carroll (2003). So I have Z = [Z1 Z2 ... Z11] where Z1,...,Z11 is a linear spline basis and X = [1 t] where t is time column in my case. I have tried various things and read a lot of the online literature but I can´t seem to find anything useful. I know the old way of fitting this using lme is: fit <- lme(y~-1+X,random=pdIdent(~-1+Z)) and then extracting the u vector with u.hat <- unlist(fit$coef$random) Is there anyone who could possibly help me and provide me with a code using the lmer? Is it possible to fit this using lmer without specifying the Z and the X matrix and instead just use the columns t and Z1, Z2, ..., Z11? Thanks in advance, Matthias ************************ Matthias Kormaksson, Ph.D Student, Department of Statistics, Cornell University ______________________________________________ R-help@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 [[alternative HTML version deleted]]
I've been wondering the same thing (how to specify "restricted" covariance structures with lmer()), and this response seemed a little opaque to me, so I was wondering if anyone could clarify. 1.) Is there currently any documentation for lmer() that explains how the model formula in lmer() specifies the cov structure of the random effects, as inquired about below? Am I correct in thinking that lmer(response ~ time +(time|id),data) would result in assuming an unconstrained cov matrix for the random effects? 2.) When lmer() is finished (thank you, by the way!), will we be able to specify the cov structure of the random effects similarly to what was done in lme(), i.e. using pdMat objects and so forth? Thanks! joran On Apr 13, 2006, at 3:34 PM, Doran, Harold wrote:> I think you want the random effects to be independent. If so then > you need > > lmer(response ~ time +(time|id) + (time-1|id), data) > > Harold > > > > -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch on behalf of Matthias > Kormaksson > Sent: Thu 4/13/2006 4:04 PM > To: r-help at stat.math.ethz.ch > Cc: > Subject: [R] Penalized Splines as BLUPs using lmer? > > Dear R-list, > > I?m trying to use the lmer of the lme4 package to fit a linear > mixed model > of the form > > Y = Xb + Zu + e > > and I can?t figure out how to control the covariance structure of > u. I want > u ~ N(0,sigma^2*I). > > More precisely I?m trying to smooth a curve through data using the > "Penalized Splines as BLUPs" method as described in Ruppert, Wand & > Carroll (2003). > > So I have Z = [Z1 Z2 ... Z11] where Z1,...,Z11 is a linear spline > basis and > X = [1 t] where t is time column in my case. > > I have tried various things and read a lot of the online literature > but I > can?t seem to find anything useful. I know the old way of fitting this > using lme is: > > fit <- lme(y~-1+X,random=pdIdent(~-1+Z)) > > and then extracting the u vector with > > u.hat <- unlist(fit$coef$random) > > Is there anyone who could possibly help me and provide me with a code > using the lmer? Is it possible to fit this using lmer without > specifying > the Z and the X matrix and instead just use the columns t and Z1, > Z2, ..., > Z11? > > Thanks in advance, > Matthias > > > ************************ > Matthias Kormaksson, > Ph.D Student, > Department of Statistics, > Cornell University > > ______________________________________________ > 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 > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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
Me, opaque (it is rare that I say too little). Well, your assumption below is correct. This structure assumes a general covariance matrix for the random effects. As for the documentation, it is rather sparse at this time. There are really two places to look. One would be the vignette in the mlmRev package vignette(MlmSoftRev) and the other would be the article below: @Article{Rnews:Bates:2005, author = {Douglas Bates}, title = {Fitting Linear Mixed Models in {R}}, journal = {R News}, year = 2005, volume = 5, number = 1, pages = {27--30}, month = {May}, url = {http://CRAN.R-project.org/doc/Rnews/}, } Harold -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Joran Elias Sent: Thursday, April 13, 2006 7:03 PM To: r-help at stat.math.ethz.ch Subject: Re: [R] Penalized Splines as BLUPs using lmer? I've been wondering the same thing (how to specify "restricted" covariance structures with lmer()), and this response seemed a little opaque to me, so I was wondering if anyone could clarify. 1.) Is there currently any documentation for lmer() that explains how the model formula in lmer() specifies the cov structure of the random effects, as inquired about below? Am I correct in thinking that lmer(response ~ time +(time|id),data) would result in assuming an unconstrained cov matrix for the random effects? 2.) When lmer() is finished (thank you, by the way!), will we be able to specify the cov structure of the random effects similarly to what was done in lme(), i.e. using pdMat objects and so forth? Thanks! joran On Apr 13, 2006, at 3:34 PM, Doran, Harold wrote:> I think you want the random effects to be independent. If so then you > need > > lmer(response ~ time +(time|id) + (time-1|id), data) > > Harold > > > > -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch on behalf of Matthias > Kormaksson > Sent: Thu 4/13/2006 4:04 PM > To: r-help at stat.math.ethz.ch > Cc: > Subject: [R] Penalized Splines as BLUPs using lmer? > > Dear R-list, > > I?m trying to use the lmer of the lme4 package to fit a linear mixed > model of the form > > Y = Xb + Zu + e > > and I can?t figure out how to control the covariance structure of u. I > want u ~ N(0,sigma^2*I). > > More precisely I?m trying to smooth a curve through data using the > "Penalized Splines as BLUPs" method as described in Ruppert, Wand & > Carroll (2003). > > So I have Z = [Z1 Z2 ... Z11] where Z1,...,Z11 is a linear spline > basis and X = [1 t] where t is time column in my case. > > I have tried various things and read a lot of the online literature > but I can?t seem to find anything useful. I know the old way of > fitting this using lme is: > > fit <- lme(y~-1+X,random=pdIdent(~-1+Z)) > > and then extracting the u vector with > > u.hat <- unlist(fit$coef$random) > > Is there anyone who could possibly help me and provide me with a code > using the lmer? Is it possible to fit this using lmer without > specifying the Z and the X matrix and instead just use the columns t > and Z1, Z2, ..., Z11? > > Thanks in advance, > Matthias > > > ************************ > Matthias Kormaksson, > Ph.D Student, > Department of Statistics, > Cornell University > > ______________________________________________ > 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 > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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______________________________________________ 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