Displaying 1 result from an estimated 1 matches for "6p63i4cxfk6enlp5".
2010 Feb 09
1
question about nlme...
I am looking for R code to be able to fit a linear-linear piecewise
model with person-specific changepoint. I have searched the web, but
have not been able to locate any code.
Below is my attempt at some code:
chgpt = function(a1,a2,a3,gam,wave){
yht=numeric(10)
y1=(wave <= gam)*(a1+(a2*wave))
y2=(wave > gam)*((a1+(a2-a3)*gam)+a3*wave)
yhat=y1+y2
return(yht)
}
nl.dat <- nlme(y ~