Learn R Programming

riskscores (version 1.2.3)

predict.risk_mod: Predict Method for Risk Model Fits

Description

Obtains predictions from risk score models.

Usage

# S3 method for risk_mod
predict(object, newx = NULL, type = c("link", "response", "score"), ...)

Value

Numeric vector of predicted values.

Arguments

object

An object of class "risk_mod", usually a result of a call to risk_mod().

newx

Optional matrix of new values for X for which predictions are to be made. If ommited, the fitted values are used.

type

The type of prediction required. The default ("link") is on the scale of the predictors (i.e. log-odds); the "response" type is on the scale of the response variable (i.e. risk probabilities); the "score" type returns the risk score calculated from the integer model.

...

Additional arguments.

Examples

Run this code
y <- breastcancer[[1]]
X <- as.matrix(breastcancer[,2:ncol(breastcancer)])
mod <- risk_mod(X, y, lambda0 = 0.01)
predict(mod, type = "link")[1]
predict(mod, type = "response")[1]
predict(mod, type = "score")[1]

Run the code above in your browser using DataLab