recipe_roles | R Documentation |
Add to or replace the roles of variables in a preprocessing recipe.
role_binom(recipe, x, size)
role_case(recipe, group, stratum, weight, replace = FALSE)
role_pred(recipe, offset, replace = FALSE)
role_surv(recipe, time, event)
recipe |
existing recipe object. |
x , size |
number of counts and trials for the specification of a
|
group |
variable defining groupings of case observations, such as repeated measurements, to keep together during resampling [default: none]. |
stratum |
variable to use in conducting stratified resample estimation of model performance. |
weight |
numeric variable of case weights for model fitting. |
replace |
logical indicating whether to replace existing roles. |
offset |
numeric variable to be added to a linear predictor, such as in a generalized linear model, with known coefficient 1 rather than an estimated coefficient. |
time , event |
numeric follow up time and 0-1 numeric or logical event
indicator for specification of a |
An updated recipe object.
recipe
library(survival)
library(recipes)
df <- within(veteran, {
y <- Surv(time, status)
remove(time, status)
})
rec <- recipe(y ~ ., data = df) %>%
role_case(stratum = y)
(res <- resample(rec, model = CoxModel))
summary(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.