P-value based backward selection on Generalized Linear Models (GLMs).

backward_select(
  object,
  data = NULL,
  backward.test = "LRT",
  backward.alpha = 0.05,
  family = gaussian(link = "identity")
)

Arguments

object

An object of class autoGAM_frame or a formula of the full model to be processed via backward elimination.

data

Data needed for creation of models. Default is NULL for objects of class autoGAM_frame where data will be automatically retrieved from the object but data needs to be specified when the object argument is a formula.

backward.test

Test to obtain P-values of predictors during the backward elimination process. Valid values are 'LRT', 'Rao', 'Chisq' & 'F'. Default is 'LRT'. See ?drop1 for more details.

backward.alpha

The maximum alpha value that predictors with P-values greater than that will be sequentially removed. Default value is 0.05.

family

The family of the response variable. Default is gaussian(link='identity') for situations where object argument is a formula (for formulas with responses from other classes, you need to specify this argument). When object is from class autoGAM_frame, default value will be automatically replaced by the true family coming from the object.

Value

If the object is from class autoGAM_frame, the $`best forms` & $`final predictors` parts of the object will be updated and a list of sequential results of backward elimination process will be added to the autoGAM_frame list. If the object is a formula, the mentioned sequential list of backward process will be returned.

See also

Author

Shahin Roshani

Examples

if (FALSE) { my_mtcars <- mtcars %>% mutate_at('vs',as.factor) carsGAM <- autoGAM_frame(mpg~disp+drat+vs,data=my_mtcars) backward_select(carsGAM) #Or for example: backward_select(mpg~poly(disp,2)+I(drat^3)+vs,data=my_mtcars) my_iris <- iris %>% filter(Species!='setosa') backward_select(Species~ns(Sepal.Length,3)+cut(Petal.Width,2),data=my_iris,family=binomial(link='logit')) }