Skip to content

Piecewise regression in lmer

4 messages · AD Hayward, Dieter Menne, Walmes Zeviani +1 more

#
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
----------------------------------------------------------------
#
AD Hayward wrote:
You might have a look a Alejandro Jara DPpackage which worked quite well for
me in a similar case.

There is also a special list dedicated to lmer:

http://news.gmane.org/gmane.comp.lang.r.lme4.devel

Dieter
#
AD Hayward wrote:
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
............
(_/............................................................................................
#
On Mon, Jan 4, 2010 at 6:24 AM, Walmes Zeviani
<walmeszeviani at hotmail.com> wrote:

            
It appears that Adam is using fixed knot positions, in which case the
segmented model is a linear model.  He is also using family = binomial
so it is a generalized linear mixed model, which does require
iterative optimization, but does not require nlmer().