if (FALSE) {
data(plant)
lattice::xyplot(y~time,groups=group,auto.key=list(space="right"), data=plant)
o<-segreg(y~ 0+group+seg(time, by=group, npsi=2), data=plant)
summary(o)
par(mfrow=c(1,2))
plot(y~time, data=plant)
plot(o, term=1:3, add=TRUE, leg=NA, psi.lines=TRUE) #add the lines to the current plot
plot(o, term=1:3, col=3:5, res.col=3:5, res=TRUE, leg="bottomright")
}
Run the code above in your browser using DataLab