[R-sig-ME] Piecewise linear regression using lme()

Goulven SALIC goulven.salic at edf.fr
Thu Jul 22 11:00:51 CEST 2010


Hi everyone,

I'm trying to fit a of piecewise regression model on a time series. The 
idea is to divide the series into segments and then to apply linear 
regression models on each segment but in a "global way" and considering 
heteroskedasticity between the segments. For example, I build a time 
series y with 3 segments:

segment1=1:20+rnorm(20,0,2)
segment2=20-2*1:30+rnorm(30,0,5)
segment3=-40+0.5*1:15+rnorm(15,0,1)

group=c(rep(1,20),rep(2,30),rep(3,15))
y=c(segment1,segment2,segment3)

Data=data.frame(y,t=1:65,group=as.factor(group))

the model I'd like to fit is:

y_t= 
(beta_01+beta_11*t+error_1)*(group==1)+(beta_02+beta_12*t+error_2)*(group==2)+(beta_03+beta_13*t+error_3)*(group==3)

It looks like a mixed effects model were the fixed effect are the 
piecewise linear regression parts (beta_0i+beta_1i*t) and the random 
effects are the variance components error_i.

The problem is that I can't find the way the write this model correctly 
using the lme() function of the package nlme. I can't remove the global 
intercept and the global variance component. Here's what I tried:

#1 Using a prior piecewise linear regression

lm.list=lmList(y~t|group,Data)

model.lme=lme(lm.list,weights=varIdent(form=~1|group))

#2 Trying to estimate the whole model directly and considering the 
different lines as random effects

model.lme=lme(y~1,random=~t|group,data=Data)

but the intercept remains...

I read a lot of R-help messages before posting this one (my first!) and 
I'm not getting any closer. It looks like no one tried to estimate the 
exact same model. I'll be very grateful if someone could help me on this.

Thanks

Goulven 
-------------- next part --------------



Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.

Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message.

Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus.
____________________________________________________

This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.

If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.

E-mail communication cannot be guaranteed to be timely secure, error or virus-free.


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