I would like to perform linear regression on a growth curve. Due to treatments I expect the growth to change not at all, once ore twice. Therefore I want to test wether my growth curve is best fitted with a linear regression (on log-transform data) with 0,1 or two breakpoints. I also would like to get the timing of the breaks and do not define them, just the number of breaks. Afterwards I would like to asked which model fits the data best.
require(segmented) out.lm<-lm(A1~Time,data=data) o<-segmented(out.lm, seg.Z= ~Time, psi=NA,control=seg.control(display=TRUE,K=2,stop.if.error=FALSE)) slope(o)
plot(o,conf.levels=0.95,shade=TRUE) points(o,link=FALSE,col=2) points(data$Time,data$A1)
which gives me the following plot: