Learn R Programming

cutpointr (version 1.1.2)

predict.cutpointr: Predict using a cutpointr object

Description

Predictions are made on the data.frame in newdata using either the variable name or by applying the same transformation to the data as in cutpointr. The class of the output will be identical to the class of the predictor.

Usage

# S3 method for cutpointr
predict(object, newdata, cutpoint_nr = 1, ...)

Arguments

object

a cutpointr object.

newdata

a data.frame with a column that contains the predictor variable.

cutpoint_nr

if multiple optimal cutpoints were found this parameter defines which one should be used for predictions. Can be a vector if different cutpoint numbers are desired for different subgroups.

...

further arguments.

See Also

Other main cutpointr functions: add_metric(), boot_ci(), boot_test(), cutpointr(), multi_cutpointr(), roc()

Examples

Run this code
# NOT RUN {
oc <- cutpointr(suicide, dsi, suicide)
## Return in-sample predictions
predict(oc, newdata = data.frame(dsi = oc$data[[1]]$dsi))
# }

Run the code above in your browser using DataLab