predict: Model Prediction

predictR Documentation

Model Prediction

Description

Predict outcomes with a fitted model.

Usage

## S3 method for class 'MLModelFit'
predict(
  object,
  newdata = NULL,
  times = numeric(),
  type = c("response", "raw", "numeric", "prob", "default"),
  cutoff = MachineShop::settings("cutoff"),
  distr = character(),
  method = character(),
  verbose = FALSE,
  ...
)

## S4 method for signature 'MLModelFit'
predict(object, ...)

Arguments

object

model fit result.

newdata

optional data frame with which to obtain predictions. If not specified, the training data will be used by default.

times

numeric vector of follow-up times at which to predict survival events/probabilities or NULL for predicted survival means.

type

specifies prediction on the original outcome ("response"), numeric ("numeric"), or probability ("prob") scale; or the "raw" predictions returned by the model. Option "default" is deprecated and will be removed in the future; use "raw" instead.

cutoff

numeric (0, 1) threshold above which binary factor probabilities are classified as events and below which survival probabilities are classified.

distr

character string specifying distributional approximations to estimated survival curves. Possible values are "empirical", "exponential", "rayleigh", or "weibull"; with defaults of "empirical" for predicted survival events/probabilities and "weibull" for predicted survival means.

method

character string specifying the empirical method of estimating baseline survival curves for Cox proportional hazards-based models. Choices are "breslow" or "efron" (default).

verbose

logical indicating whether to display printed output generated by some model-specific predict functions to aid in monitoring progress and diagnosing errors.

...

arguments passed from the S4 to the S3 method.

See Also

confusion, performance, metrics

Examples


## Requires prior installation of suggested package gbm to run

## Survival response example
library(survival)

gbm_fit <- fit(Surv(time, status) ~ ., data = veteran, model = GBMModel)
predict(gbm_fit, newdata = veteran, times = c(90, 180, 360), type = "prob")



MachineShop documentation built on Sept. 11, 2024, 6:28 p.m.