ocp | R Documentation |
Approach originally from Harrell Jr, FE. Regression modeling strategies, 2nd Edition. Method as described in Steyerberg EW. Clinical Prediction Models, 2nd Edition. pp 106–107
ocp(
mwf,
form,
data,
metric = sbrier,
reps = 250,
get_probs = predict,
event = "1"
)
mwf |
A function that represents the entire modeling workflow. Should take arguments “form' and 'data' fit a model then return it to make predictions. |
form |
A formula describing the model. |
data |
A data frame including all variables in 'form'. |
metric |
A performance metric as function that takes ('preds', 'obs') to calculate. Default = 'sbrier' |
reps |
The number of bootstrap replicates. Default = 250. |
get_probs |
A predict function to extract class probabilities. Default = 'predict' |
event |
The outcome class for an event, especially for factors. Default = '1' |
glm_mwf <- \(form, data) { glm(form, data = data, family = binomial) }
mymtcars <- mtcars
mymtcars$mpg20 <- as.numeric(mymtcars$mpg > 20)
ocp(glm_mwf, form = mpg20 ~ cyl + disp + hp, data = mymtcars,
get_probs = \(m, d) predict(m, newdata = d, type = 'response'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.