[R] Piecewise regression in lmer

Walmes Zeviani walmeszeviani at hotmail.com
Mon Jan 4 13:24:07 CET 2010




AD Hayward wrote:
> 
> Dear all,
> 
> I'm attempting to use a piecewise regression to model the trajectory  
> of reproductive traits with age in a longitudinal data set using a  
> mixed model framework. The aim is to find three slopes and two points-  
> the slope from low performance in early age to a point of high  
> performance in middle age, the slope (may be 0) of the plateau from  
> the start of high performance to the end of high performance , and the  
> slope of the decline from the end of high performance to the end of  
> life.
> 
> I've found the segmented package useful, but it cannot be implemented  
> in a mixed model framework. I've also attempted piecewise regression  
> using this formula in lmer:
> 
> m<-lmer(repro ~ OTHER FIXED EFFECTS + age*(age < 2) + age*(age >= 2 &  
> age < 8) + age*(age >= 8) + (1|id) + (1|yr), data = reproduction,  
> family = binomial, link = "logit", GHQ = TRUE)
> 
> However, this gives the warning:
> 
> Warning message:
> In mer_finalize(ans) : gr cannot be computed at initial par (65)
> 
> which is not apparent if I use just two break points or I implement  
> the model in glm.
> 
> My question is essentially whether anyone can recommend a method for  
> performing piecewise regression in lmer or another mixed model  
> framework. Any advice would be greatly appreciated.
> 
> Regards,
> 
> Adam
> 
> 
> ----------------------------------------------------------------
> Adam Hayward
> PhD Student
> Wild Evolution Group
> Institute of Evolutionary Biology
> Room 133 Ashworth Laboratories
> King's Buildings
> University of Edinburgh
> West Mains Road
> Edinburgh
> EH9 3JT
> 
> adam.hayward at ed.ac.uk
> http://wildevolution.biology.ed.ac.uk/lkruuk/AdamHayward.html
> ----------------------------------------------------------------
> 
> -- 
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
> 
> ______________________________________________
> R-help at r-project.org 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.
> 
> 


Adam,

A segmented linear model, for estimation purposes, is a nonlinear model. It
requires a iteractive procedure for estimation of fixed effects. You could
use nlmer() for this.

Walmes Zeviani, Lavras - MG, Brasil.


-----
..oooO
..................................................................................................
..(....)... 0ooo...                              Walmes Zeviani
...\..(.....(.....)...     Master in Statistics and Agricultural
Experimentation
....\_)..... )../....       walmeszeviani at hotmail.com, Lavras - MG, Brasil
............
(_/............................................................................................
-- 
View this message in context: http://n4.nabble.com/Piecewise-regression-in-lmer-tp998154p998229.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list