Plot method for stepmented objects
plot.stepmented.RdTakes a fitted stepmented object returned by stepmented() and plots (or adds)
the fitted piecewise constant lines for the selected stepmented term.
Usage
# S3 method for class 'stepmented'
plot(x, term, add = FALSE, res = TRUE, conf.level=0, interc = TRUE, add.fx = FALSE,
psi.lines = TRUE, link=TRUE, const=NULL, res.col=grey(.15, alpha = .4),
surf=FALSE, zero.cor=TRUE, heurs=TRUE, shade=FALSE, se.type=c("cdf","abs","none"),
k=NULL, .vcov=NULL, leg="topleft", ...)Arguments
- x
a fitted
stepmentedobject.- term
the stepmented variable having the piece-wise constant relationship to be plotted. If there is a single stepmented variable in the fitted model
x,termcan be omitted.- add
when
TRUEthe fitted lines are added to the current device.- res
when
TRUEthe fitted lines are plotted along with corresponding partial residuals.- conf.level
the confidence level for the pointwise confidence intervals for the expected values.
- interc
if
TRUEthe computed components include the model intercept (if it exists).- add.fx
logical. If TRUE and the object fit also includes an additional term for the same stepmented variable, the plot also portrays such `additional' term.
- psi.lines
if
TRUEvertical lines corresponding to the estimated changepoints are also drawn- link
if
FALSEthe fitted lines (and possibily the residuals) are reported on the response scale. Ignored if the fit objectxis not a glm-like fit.- const
constant to add to each fitted segmented relationship (on the scale of the linear predictor) before plotting. If
const=NULLand the fit includes a segmented interaction term (obtained viaseg(..,by)in the formula), the group-specific intercept is included.- res.col
when
res=TRUEit means the color of the points representing the partial residuals.- surf
if the object fit
xincludes 2 stepmented covariates (x1 and x2, say) with relevant estimated breakpoints,surf=TRUEwill draw on the plane x1-x2 the areas splitted according to the estimated breakpoints with corresponding estimated means superimposed.- zero.cor
see
zero.corinvcov.stepmented; effective only ifconf.level>0.- heurs
logical; if
TRUE, heuristic (usually somewhat conservative) confidence intervals are computed and plotted; effective only ifconf.level>0.- shade
if
TRUEthe pointwise confidence intervals are portrayed via shaded area; effective only ifconf.level>0.- se.type
which standard errors should be computed? see
typeinvcov.stepmented; effective only ifconf.level>0.- k
The value to be passed to
vcov.stepmentedto computed the standard errors.- .vcov
The estimate var-covariance matrix; if
NULL, it is computed internally byvcov.stepmented.- leg
If the plot refers to stepmented relationships in groups, i.e.
termhas been specified as a vector, a legend is placed at the specifiedlegposition. PutNAnot to draw the legend.- ...
other graphics parameters to pass to plotting commands: `col', `lwd' and `lty' (that can be vectors and are recycled if necessary, see the example below) for the fitted piecewise constant lines; `ylab', `xlab', `main', `sub', `cex.axis', `cex.lab', `xlim' and `ylim' when a new plot is produced (i.e. when
add=FALSE); `pch' and `cex' for the partial residuals (whenres=TRUE,res.colis for the color).
Details
Produces (or adds to the current device) the fitted step-function like relationship between the
response and the selected term. If the fitted model includes just a single `stepmented' variable,
term may be omitted. If surf=TRUE, and res=TRUE the point widths are proportional to the partial residual values.
Note
Implementation of confidence intervals for the conditional means in stepmented regression is under development; conf.level>0 should be used with care, especially with multiple jumpoints.
See also
See Also as stepmented
Examples
#Following code in stepmented..
if (FALSE) { # \dontrun{
par(mfrow=c(1,3))
plot(os,"x")
plot(os,"z")
plot(os,"z", add.fx=TRUE, psi.lines=FALSE )
lines(os, "z")
#display the 'surface'
par(mfrow=c(1,3))
plot(os, surf=TRUE, col=1, res.col=2)
plot(os, surf=TRUE, lty=2)
plot(x,z)
plot(os, surf=TRUE, add=TRUE, col=4, res=FALSE)
} # }