Fitted values for segmented relationships
broken.line.RdGiven a segmented model (typically returned by a segmented method), broken.line
computes the fitted values (and relevant standard errors) for the specified `segmented' relationship.
Usage
broken.line(ogg, term = NULL, link = TRUE, interc=TRUE, se.fit=TRUE, isV=FALSE,
.vcov=NULL, .coef=NULL, ...)Arguments
- ogg
A fitted object of class segmented (returned by any
segmentedmethod).- term
Three options. i) A named list (whose name should be one of the segmented covariates in the model
ogg) including the covariate values for which segmented predictions should be computed; ii) a character meaning the name of any segmented covariate in the model (and predictions corresponding to the observed covariate values are returned); iii) It can beNULLif the model includes a single segmented covariate (and predictions corresponding to the observed covariate values are returned).- link
Should the predictions be computed on the scale of the link function if
oggis a segmented glm fit? Default toTRUE.- interc
Should the model intercept be added? (provided it exists).
- se.fit
If
TRUEalso standard errors for predictions are returned.- isV
A couple of logicals indicating if the segmented terms \((x-\psi)_+\) and \(I(x>\psi)\) in the model matrix should be replaced by their smoothed counterparts when computing the standard errors. If a single logical is provided, it is applied to both terms.
- .vcov
Optional. The full covariance matrix of estimates. If
NULL(andse.fit=TRUE), the matrix is computed internally viavcov.segmented().- .coef
The regression parameter estimates. If unspecified (i.e.
NULL), it is computed internally bycoef(ogg).- ...
Additional arguments to be passed on to
vcov.segmented()when computing the standard errors for the predictions, namelyis,var.diff,p.df. Seesummary.segmentedandvcov.segmented.
Details
If term=NULL or term is a valid segmented covariate name,
predictions for that segmented variable are the relevant fitted values from the model. If term
is a (correctly named) list with numerical values, predictions corresponding to such specified values
are computed. If link=FALSE and ogg inherits from the class "glm", predictions and possible standard
errors are returned on the response scale. The standard errors come from the Delta method.
Argument link is ignored whether ogg does not inherit from the class "glm".
Value
A list having one component if (if se.fit=FALSE), and two components (if se.fit=TRUE) list representing predictions and standard errors for the segmented covariate values.