backward_select: backward_select

Description Usage Arguments Value Author(s) See Also Examples

View source: R/backward_select.R

Description

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

Usage

1
2
3
4
5
6
7
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.

Author(s)

Shahin Roshani

See Also

https://shahin-roshani.github.io/autoGAM/articles/autoGAM.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 

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'))


## End(Not run)

Shahin-Roshani/autoGAM documentation built on Dec. 18, 2021, 1:05 p.m.