broken.line {segmented} | R Documentation |
Given a segmented model (typically returned by a segmented
method), broken.line
computes the fitted values for each `segmented' relationship.
broken.line(ogg, term = NULL, gap = FALSE, linkinv = FALSE)
ogg |
A fitted object of class segmented (returned by any segmented method). |
term |
A character meaning for which segmented variable prediction should be computed. |
gap |
Should the `gaps' of the segmented relationships be plotted? Default to FALSE . Currently unimplemented. |
linkinv |
Should the predictions be computed on the scale of the link function? Default to FALSE . |
If term=NULL
predictions for each segmented variable in the fitted model are computed. Argument linkinv
is ignored whether ogg
does not inherit from the class "glm".
A matrix whose columns represent predictions for the segmented variables.
set.seed(1234) z<-runif(100) y<-rpois(100,exp(2+1.8*pmax(z-.6,0))) o<-glm(y~z,family=poisson) o.seg<-segmented(o,seg.Z=~z,psi=list(z=.5)) plot(z,y) points(z,broken.line(o.seg,linkinv=TRUE),col=2,pch=20)