bs.reg: Variable selection in regression models with backward...

View source: R/bs.reg.R

Backward selection regressionR Documentation

Variable selection in regression models with backward selection

Description

Variable selection in regression models with backward selection

Usage

bs.reg(target, dataset, threshold = 0.05, wei = NULL, test = NULL, user_test = NULL)

Arguments

target

The class variable. Provide either a string, an integer, a numeric value, a vector, a factor, an ordered factor or a Surv object. See also Details. For the gamma regression this must a vector with strictly positive numbers (no zeros allowed).

dataset

The dataset; provide either a data frame or a matrix (columns = variables, rows = samples). In either case, only two cases are avaialble, either all data are continuous, or categorical.

threshold

Threshold (suitable values in (0, 1)) for assessing p-values significance. Default value is 0.05.

test

The regression model to use. Available options are most of the tests for SES and MMPC. The ones NOT available are "censIndER", "testIndMVreg", "testIndSpearman". If you want to use multinomial or ordinal logistic regression, make sure your target is factor. See also SES and CondIndTests for the tests.

wei

A vector of weights to be used for weighted regression. The default value is NULL. An example where weights are used is surveys when stratified sampling has occured.

user_test

A user-defined conditional independence test (provide a closure type object). Default value is NULL. If this is defined, the "test" argument is ignored.

Details

If the sample size is less than the number of variables a meesage will appear and no backward regression is performed.

Value

The output of the algorithm is S3 object including:

runtime

The run time of the algorithm. A numeric vector. The first element is the user time, the second element is the system time and the third element is the elapsed time.

info

A matrix with the non selected variables and their latest test statistics and logged p-values.

mat

A matrix with the selected variables and their latest statistics and logged p-values.

ci_test

The conditional independence test used.

final

The final regression model.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr

See Also

glm.fsreg, lm.fsreg, bic.fsreg, bic.glm.fsreg, CondIndTests, MMPC, SES

Examples

set.seed(123)
dataset <- matrix( runif(200 * 10, 1, 100), ncol = 10 )
target <- rnorm(200)
a <- bs.reg(target, dataset, threshold = 0.05, test = "testIndRQ") 
b <- bs.reg(target, dataset, threshold = 0.05, test = "testIndReg") 
b2 <- bs.reg(target, dataset, threshold = 0.05, test = "testIndFisher") 

MXM documentation built on Aug. 25, 2022, 9:05 a.m.