factor_remove: Remove predictor from the current model formula

View source: R/factor_remove.R

factor_removeR Documentation

Remove predictor from the current model formula

Description

Removes the predictor from the list of predictors. These will be used in model formula when model_fit is called.

Usage

factor_remove(setup, var_symbol)

Arguments

setup

Setup object. Created at the start of the workflow. Usually piped in from previous step.

var_symbol

Unquoted symbol. Predictor to be removed. Must be present in the modeling dataset.

Value

Setup object with updated attributes.

Examples

require(dplyr) # for the pipe operator
data('sev_train')

setup <- setup(
  data_train = sev_train,
  target = 'sev',
  weight = 'numclaims',
  family = 'gamma',
  keep_cols = c('pol_nbr', 'exposure', 'premium')
)

modeling <- setup %>%
  factor_add(pol_yr) %>%
  factor_add(agecat) %>%
  model_fit() %>%
  factor_remove(agecat)


realgabon/insuRglm documentation built on Jan. 2, 2023, 2:51 a.m.