Learn R Programming

scar (version 0.2-2)

predict.scar: Predict method for scar fits

Description

This function obtains predictions from a fitted scar object.

Usage

# S3 method for scar
predict(object, newdata, type = c("link", "response"), rule=1, ...)

Arguments

object

A fitted scar object produced by scar.

newdata

An optional numeric matrix of \(d\) columns, with each row specifying a location at which prediction is required. This argument can be missing, in which case predictions are made at the same values of the covariates used to compute the object.

type

Type of predictions, with choices "link" (the default), or "response". The default produces predictions on the scale of the additive predictors. If "response" is selected, the predictions are on the scale of the response (i.e. mean of the exponential family), and are monotone transformations of the additive predictors using the inverse link function.

rule

An integer describing how to handle the new data outside the range of the observed covariates. If rule=1, then we use linear interpolation to get the value of each fitted component function outside the range of observed covariates. Otherwise if rule=2, then the value at the closest data extreme is used. Note that if there is convex/concave component, the choice of the first rule can lead to somewhat unsatifactary performance on/outside the boundary of the data (when comparing to the second rule).

...

Further arguments passed to or from other methods.

Value

A numeric vector of predictions.

See Also

scar, plot.scar

Examples

Run this code
# NOT RUN {
## See examples for the function scar
# }

Run the code above in your browser using DataLab