[R] Piecewise regression in lmer

AD Hayward adam.hayward at ed.ac.uk
Mon Jan 4 11:03:10 CET 2010


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.



More information about the R-help mailing list