| sample_lm | R Documentation |
Sample the conditional distribution created by a linear model
sample_lm(model, new_data, conf_data)
model |
A "model_fit" object created by parsnip::linear_reg() |
new_data |
A data frame with predictors |
conf_data |
A data frame with original confidential predictors |
A numeric vector of predictions
lm_mod <- parsnip::linear_reg() |>
parsnip::set_engine("lm") |>
parsnip::set_mode(mode = "regression")
regression_rec <- recipes::recipe(inctot ~ ., data = acs_conf)
model_reg <- workflows::workflow() |>
workflows::add_model(spec = lm_mod) |>
workflows::add_recipe(recipe = regression_rec) |>
parsnip::fit(data = acs_conf)
set.seed(1)
sample1 <- sample_lm(
model = model_reg,
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.