| sample_glm | R Documentation |
Currently, logistic and poisson regression are supported using parsnip and
the standard glm engine. Note that poisson regression requires the suggested
poissonreg library.
sample_glm(model, new_data, conf_data)
model |
A "model_fit" object created by parsnip |
new_data |
A data frame with predictors |
conf_data |
A data frame with original confidential predictors |
A numeric vector of predictions
acs_conf <- acs_conf |>
tidyr::drop_na()
logistic_mod <- parsnip::logistic_reg() |>
parsnip::set_engine("glm") |>
parsnip::set_mode(mode = "classification")
classification_rec <- recipes::recipe(hcovany ~ ., data = acs_conf)
model_class <- workflows::workflow() |>
workflows::add_model(spec = logistic_mod) |>
workflows::add_recipe(recipe = classification_rec) |>
parsnip::fit(data = acs_conf)
set.seed(1)
sample1 <- sample_glm(
model = model_class,
new_data = acs_conf[1:3, ],
conf_data = acs_conf
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.