Title: | A Procedure for Multicollinearity Testing using Bootstrap |
---|---|
Description: | Functions for detecting multicollinearity. This test gives statistical support to two of the most famous methods for detecting multicollinearity in applied work: Klein’s rule and Variance Inflation Factor (VIF). See the URL for the papers associated with this package, as for instance, Morales-Oñate and Morales-Oñate (2015) <doi:10.33333/rp.vol51n2.05>. |
Authors: | Víctor Morales-Oñate [aut, cre] , Bolívar Morales-Oñate [aut] |
Maintainer: | Víctor Morales-Oñate <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.1 |
Built: | 2024-10-29 03:30:37 UTC |
Source: | https://github.com/vmoprojs/mtest |
MTest is a nonparametric test based on bootstrap for detecting multicollinearity. This test gives statistical support to two of the most famous methods for detecting multicollinearity in applied work: Klein’s rule and Variance Inflation Factor (VIF for essential multicollinearity).
MTest(object, nboot = 100, nsam = NULL,trace = FALSE,seed = NULL, valor_vif = 0.9)
MTest(object, nboot = 100, nsam = NULL,trace = FALSE,seed = NULL, valor_vif = 0.9)
object |
an object representing a model of an appropriate class (mainly "lm"). This is used as the model in MTest. |
nboot |
Numeric; number of bootstrap iterations to obtain the probability distribution of R squared (global and auxiliar). |
nsam |
Numeric; sample size for bootstrap samples. |
trace |
Logical; prints iteration process. |
seed |
Numeric; seed value for the bootstrap in nboot parameter. |
valor_vif |
Numeric; value to be compared in kleins rule. |
MTest generates a bootstrap distribution for the coefficient of determination which lets the researcher assess multicollinearity by setting a statistical significance , or more precisely, an achieved significance level (ASL) for a given threshold.
Consider the regression model
where ,
are the predictors with
,
for all
and
is the gaussian error term.
In order to describe Klein's rule and VIF methods, we need to define auxiliary regressions associated to model. An example of an auxiliary regressions is:
In general, there are auxiliary regressions and the dependent variable is omitted in each auxiliary regression. Let
be the coefficient of determination of the model and
the
coefficient of determination of the
auxiliary regression.
Returns an object of class MTest
.
An object of class MTest
is a list containing
at most the following components:
pval_vif |
p values for vif test; |
pval_klein |
p values for klein test; |
Bvals |
A |
vif.tot |
Observed VIF values; |
R.tot |
Observed |
nsam |
sample size used in bootstrap procedure. |
Víctor Morales Oñate, [email protected], https://sites.google.com/site/moralesonatevictor/,https://www.linkedin.com/in/vmoralesonate/ Bolívar Morales Oñate, [email protected], https://sites.google.com/site/moralesonatevictor/
Morales-Oñate, V., and Morales-Oñate, B. (2023). MTest: a Bootstrap Test for Multicollinearity. Revista Politécnica, 51(2), 53–62. doi:10.33333/rp.vol51n2.05
library(MTest) data(simDataMTest) m1 <- lm(y~.,data = simDataMTest) boot.sol <- MTest(m1,trace=FALSE,seed = 1,nboot = 50) boot.sol$pval_vif boot.sol$pval_klein head(boot.sol$Bvals) print(boot.sol)
library(MTest) data(simDataMTest) m1 <- lm(y~.,data = simDataMTest) boot.sol <- MTest(m1,trace=FALSE,seed = 1,nboot = 50) boot.sol$pval_vif boot.sol$pval_klein head(boot.sol$Bvals) print(boot.sol)
Returns the -value of the columns of
X
(pairwisely).
pairwiseKStest(X,alternative="greater")
pairwiseKStest(X,alternative="greater")
X |
Numeric; a matrix ( |
alternative |
String; letter of the value, but the argument name must be given in full. See ‘ks.test’ for the meanings of the possible values. |
Using a pairwise Kolmogorov-Smirnov (KS) test of a given matrix X
. In particular, if X
is the Bvals
output from MTest
function, pairwiseKStest
establishes a guide for an educated removal of variables that are causing multicolli-nearity.
Note that the matrix (which is
Bvals
output from MTest
function) allow us to inspect results in detail and make further tests such as boxplots, pariwise Kolmogorov-Smirnov (KS) of the predictors and so on.
Returns an object of class pairwiseKStest
.
An object of class pairwiseKStest
is a list containing
at most the following components:
KSpwMatrix |
|
alternative |
Character; indicates the alternative hypothesis. |
Suggestion |
Character; indicates row sums (or col sums) of |
Víctor Morales Oñate, [email protected], https://sites.google.com/site/moralesonatevictor/,https://www.linkedin.com/in/vmoralesonate/ Bolívar Morales Oñate, [email protected], https://sites.google.com/site/moralesonatevictor/
Morales-Oñate, V., and Morales-Oñate, B. (2023). MTest: a Bootstrap Test for Multicollinearity. Revista Politécnica, 51(2), 53–62. doi:10.33333/rp.vol51n2.05
library(MTest) data(simDataMTest) pairwiseKStest(X=simDataMTest)
library(MTest) data(simDataMTest) pairwiseKStest(X=simDataMTest)
This data set helps testing functions in MTest package, the generating process is documented in the reference.
simDataMTest
simDataMTest
A dataframe containing 10000 observations and four columns.
Morales-Oñate, V., and Morales-Oñate, B. (2023). MTest: a Bootstrap Test for Multicollinearity. Revista Politécnica, 51(2), 53–62. doi:10.33333/rp.vol51n2.05