Learn R Programming

SignifReg (version 3.0)

SignifReg: Significance Controlled Variable Selection in Linear Regression

Description

Significance controlled variable selection selects variables in a linear regression model with different directions of the algorithm (forward, backward, stepwise) based on a chosen criterion (AIC, BIC, adjusted r-square, PRESS or p-value). The algorithm selects a final model with only significant variables based on a correction choice of False Discovery Rate, Bonferroni, or fixed level.

Usage

SignifReg(fit, scope, alpha = 0.05, direction = "forward", criterion = "p-value",
 correction = "FDR", trace=FALSE)

Arguments

fit

an lm object representing a model. It is an initial model for the variable selection

scope

The range of models examined in regression. It should be either a data.frame or formula containing predictors. When scope is data.frame, all variables except the response variable in the data.frame are considered for the variable selection.

alpha

Significance level. Default value is 0.05.

direction

Direction in variable selection: direction = "both",

direction = "forward", and

direction = "backward" are available. direction = "both" is a stepwise selection. Default is direction = "forward".

criterion

Criterion to select predictor variables. criterion = "AIC", criterion = "BIC", criterion = "r-adj" (adjusted r-square), and criterion = "p-value" are available. Default is p-value.

correction

Correction for multiple testing accumulation of error. correction = "FDR" (False Discovery Rate), correction = "Bonferroni", and

correction = "None" (no correction) are available. Default is

correction = "FDR" . For Bonferroni correction,

either correction = "Bonferroni" or correction = "Bonf" can be used.

trace

If true, information is printed for each step of variable selection. Default is FALSE. Offers summaries of prospective models as each predictor in the scope is added to or removed from the model. max_pvalue indicates the maximum p-value from the multiple t-tests for each predictor in the model. This value can be used as a criterion in the case criterion = "p-value". alpha_cut_off, Bonferroni, and FDR represent whether the model satisfies the significance by correction. alpha_cut_off means no correction and all p-values will be compared to it.

Value

SifnifReg returns an object of the class lm for a regression model.

Details

SignifReg selects only significant predictors according to a designated criterion. A model with the best criterion, for example, the smallest AIC, will not be considered if it includes insignificant predictors based on the chosen correction. When the criterion is "p-value", at each step, the variable to be added or removed is the one that generates a model having the smallest maximum p-value of the t-tests in the prospective models. This step is repeated as long as every predictor is significant according to the correction criterion. In the case that the criterion is "AIC", and "BIC", SignifReg selects, at each step, the model having the smallest value of the criterion among models having only significant predictors according to the chosen correction.

References

Zambom A Z, Kim J. Consistent significance controlled variable selection in high-dimensional regression. Stat.2018;7:e210. https://doi.org/10.1002/sta4.210

See Also

add1SignifReg, drop1SignifReg, add1summary, drop1summary

Examples

Run this code
# NOT RUN {
##mtcars data is used as an example.

data(mtcars)

fit1 <- lm(mpg~1, mtcars)
summary(SignifReg(fit1))
summary(SignifReg(fit1, scope=mtcars ,criterion="r-adj", direction="forward" 
,correction="None", trace=TRUE))
summary(SignifReg(fit1, scope=~.+disp+cyl+wt+qsec, criterion="p-value", direction="both",
correction="FDR", trace=TRUE))

fit2 <- lm(mpg~., mtcars)
summary(SignifReg(fit2, scope=~.-disp-cyl-wt-hp-drat-qset-carb , direction="backward", 
correction="Bonf", trace=TRUE))
summary(SignifReg(fit2, scope=mtcars ,criterion="AIC", direction="both",
correction="None", trace=TRUE))
# }

Run the code above in your browser using DataLab