Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

lm.bsreg

backward selection with the F test or the partial correlation coefficient


Description

backward selection with the F test or the partial correlation coefficient.

Usage

lm.bsreg(y, x, alpha = 0.05, type = "F")

Arguments

y

The dependent variable, a numerical vector with numbers.

x

A numerical matrix with the indendent variables. We add, internally, the first column of ones.

alpha

If you want to perform the usual F (or t) test set this equal to "F". For the test based on the partial correlation set this equal to "cor".

type

The type of backward selection to be used, "F" stands for F-test, where "cor" stands for partial correlation.

Details

It performs backward selection with the F test or the partial correlation coefficient. For the linear regression model, the Wald test is equivalent to the partial F test. So, instead of performing many regression models with single term deletions we perform one regression model with all variables and compute their Wald test effectively. Note, that this is true, only if the design matrix "x" contains the vectors of ones and in our case this must be, strictly, the first column. The second option is to compute the p-value of the partial correlation.

Value

A matrix with two columns. The removed variables and their associated pvalue.

Author(s)

Michail Tsagris

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

References

Hastie T., Tibshirani R. and Friedman J. (2008). The Elements of Statistical Learning (2nd Ed.), Springer.

See Also

Examples

y <- rnorm(150)
x <- as.matrix(iris[, 1:4])
a <- lm(y ~., data.frame(x) )
lm.bsreg(y, x)

Rfast2

A Collection of Efficient and Extremely Fast R Functions II

v0.0.9
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Stefanos Fafalios and Marios Dimitriadis.
Initial release
2021-03-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.