imcdiag: Individual Multicollinearity Diagnostic Measures

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/imcdiag.R

Description

Computes different measures of multicollinearity diagnostics for each regressor in the design matrix X. Individual measures includes variance Inflation factor (VIF) (Marquardt, 1970), Farrar F-test for determination of multicollinearity (Farrar and Glauber, 1967), Auxiliary F-test for relationship between F and R-square(Gujarati and Porter, 2008), Leamer's method (Greene, 2002), Corrected VIF (CVIF) Curto and Pinto (2011) <doi: 10.1080/02664763.2010.505956>, Klein's rule Klein (1962), and IND1 & IND2 (Imdad, et. al., 2019) <https://doi.org/10.17576/jsm-2019-4809-26> proposed by the researchers.

Usage

1
2
3
imcdiag(mod, method = NULL, na.rm = TRUE, corr = FALSE, 
              vif = 10, tol = 0.1, conf = 0.95, cvif = 10, ind1 = 0.02, 
              ind2 = 0.7, leamer = 0.1, all = FALSE, ...)

Arguments

mod

A model object, not necessarily type lm

na.rm

Whether to remove missing observations.

method

Specific individual measure of collinearity such as VIF, CVIF, and Leamer, etc. For example, method="VIF".

corr

Whether to display correlation matrix or not, by default corr=FALSE.

vif

Default threshold for VIF measure, vif=10.

tol

Default threshold for TOL measure, tol=0.10.

conf

Default confidence level for Farrar's Wi test, conf=0.99.

cvif

Default threshold for CVIF measure, CVIF=10.

ind1

Default threshold for IND1 indicator, ind1=0.02

ind2

Default threshold for IND2 indicator, ind2=0.7

leamer

Default threshold for Leamer's method, leamer=0.1.

all

Returns all individual measure of collinearity in a matrix of 0 (not detected) or 1 (detected).

...

Extra argument(s) if used will be ignored.

Details

The imcdiag function detects the existence of multicollinearity due to x-variable. That's why named as individual measures of diagnostics. This includes VIF, TOL, Klein's rule, Farrar and Glauber F-test, F and R^2 relation, Leamer's method, CVIF, IND1, and IND2 diagnostic measures of multicollinearity. If method argument is used (method="VIF"), the VIF values for each regressor will be displayed with decision of either collinearity exists or not which is indicated by 0 (collinearity is not detected by method for regressor) and 1 (collinearity is detected by the method for regressor). If argument all=TRUE all individual measures of collinearity will be displayed in a matrix of 0 (collinearity is not detected) or 1 (collinearity is detected).

Value

This function detects the existence of multicollinearity by using different available diagnostic measures already available in literature. The function returns the value of diagnostic measures with decision of either collinearity is detected by the diagnostic measure or not. Value of 1 indicates that collinearity is detected and 0 indicates that measure could not detect the existence of collinearity. A list object of class "imc" is returned:

x

A numeric matrix of regressors.

y

A vector of response variable.

idiags

Listing of specific individual measure such as method="CVIF" provided. If method is not used all individual diagnostics will be displayed.

method

Specific individual collinearity measure, such as VIF, TOL, CVIF, IND1, and IND2 etc.

corr

Logical, if FALSE (the default value) a correlation matrix will not be displayed.

R2

R-square from regression of all regressors X on response variable y.

call

The matched call.

pval

Returns significant regressor as number after comparing the p-value of regressors from summary.lm function with 1-conf.

all

If TRUE individual collinearity measures will be returned as a matrix of 0 or 1.

alldiag

Matrix of all individual collinearity measures indicated as either 0 (collinearity not detected) or 1 (collinearity detected) for each diagnostic measure and each regressor.

Note

Missing values in data will be removed by default. There is no method for the detection of multicollinearity, if missing values exists in the data set.

Author(s)

Muhammad Imdad Ullah, Muhammad Aslam

References

Belsely, D. A. A Guide to Using the Collinearity Diagnostics. Computer Science in Economics and Management, 4(1): 33–50, 1991.

Belsley, D. A., Kuh, E., and Welsch, R. E. Regression Diagnostics: Identifying Influential Data and Sources of Collinearity. John Wiley \& Sons, New York, 1980.

Chatterjee, S. and Hadi, A. S. Regression Analysis by Example. John Wiley \& Sons, 4th edition, New York, 2006.

Curto, J. D. and Pinto, J. C. The Corrected VIF (CVIF). Journal of Applied Statistics, 38(7), 1499–1507.

Greene, W. H. Econometric Analysis. Prentice–Hall, Upper Saddle River, New Jersey, 4th edition, 2000.

Imdad, M. U. Addressing Linear Regression Models with Correlated Regressors: Some Package Development in R (Doctoral Thesis, Department of Statistics, Bahauddin Zakariya University, Multan, Pakistan), 2017.

Imdadullah, M., Aslam, M., and Altaf, S. mctest: An R Package for Detection of Collinearity Among Regressors. The R Journal, 8(2):499–509, 2016.

Imdad, M. U., Aslam, M., Altaf, S., and Ahmed, M. Some New Diagnostics of Multicollinearity in Linear Regression Model. Sains Malaysiana, 48(2): 2051–2060, 2019.

See Also

Overall collinearity diagnostic omcdiag, collinearity plot mc.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Hald Cement data
data(Hald)
model <- lm(y~X1+X2+X3+X4, data = as.data.frame(Hald))

## all Individual measures
id<-imcdiag(model); id$idiags[,1]

# VIF measure with custom VIF threshold
imcdiag(model, method = "VIF", vif = 5)

# IND1 measure with custom IND1 threshold and correlation matrix
imcdiag(model, method="IND1", ind1=0.01, corr=TRUE)

# CVIF measure with custom CVIF threshold and correlation matrix
imcdiag(model, method = "CVIF", cvif = 5, corr = TRUE)

# Collinearity Diagnostic measures in matrix of 0 or 1
imcdiag(model, all = TRUE)
imcdiag(model, method = "VIF", all = TRUE)

## only VIF values without collinearity detection indication
imcdiag(model, method = "VIF")[[1]][,1]
plot(imcdiag(model, method = "VIF")[[1]][,1]) # vif plot

Example output

       X1        X2        X3        X4 
 38.49621 254.42317  46.86839 282.51286 

Call:
imcdiag(mod = model, method = "VIF", vif = 5)


 VIF Multicollinearity Diagnostics

        VIF detection
X1  38.4962         1
X2 254.4232         1
X3  46.8684         1
X4 282.5129         1

Multicollinearity may be due to X1 X2 X3 X4 regressors

1 --> COLLINEARITY is detected by the test 
0 --> COLLINEARITY is not detected by the test

===================================

Call:
imcdiag(mod = model, method = "IND1", corr = TRUE, ind1 = 0.01)


 IND1 Multicollinearity Diagnostics

     IND1 detection
X1 0.0087         1
X2 0.0013         1
X3 0.0071         1
X4 0.0012         1

Multicollinearity may be due to X1 X2 X3 X4 regressors

1 --> COLLINEARITY is detected by the test 
0 --> COLLINEARITY is not detected by the test

===================================

Correlation Matrix
           X1         X2         X3         X4
X1  1.0000000  0.2285795 -0.8241338 -0.2454451
X2  0.2285795  1.0000000 -0.1392424 -0.9729550
X3 -0.8241338 -0.1392424  1.0000000  0.0295370
X4 -0.2454451 -0.9729550  0.0295370  1.0000000

====================NOTE===================

X1 and X3 may be collinear as |-0.824134|>=0.7 
X2 and X4 may be collinear as |-0.972955|>=0.7 


Call:
imcdiag(mod = model, method = "CVIF", corr = TRUE, cvif = 5)


 CVIF Multicollinearity Diagnostics

      CVIF detection
X1 -0.5846         0
X2 -3.8635         0
X3 -0.7117         0
X4 -4.2900         0

NOTE:  CVIF Method Failed to detect multicollinearity


0 --> COLLINEARITY is not detected by the test

===================================

Correlation Matrix
           X1         X2         X3         X4
X1  1.0000000  0.2285795 -0.8241338 -0.2454451
X2  0.2285795  1.0000000 -0.1392424 -0.9729550
X3 -0.8241338 -0.1392424  1.0000000  0.0295370
X4 -0.2454451 -0.9729550  0.0295370  1.0000000

====================NOTE===================

X1 and X3 may be collinear as |-0.824134|>=0.7 
X2 and X4 may be collinear as |-0.972955|>=0.7 


Call:
imcdiag(mod = model, all = TRUE)


All Individual Multicollinearity Diagnostics in 0 or 1 

   VIF TOL Wi Fi Leamer CVIF Klein IND1 IND2
X1   1   1  1  1      0    0     0    1    1
X2   1   1  1  1      1    0     1    1    1
X3   1   1  1  1      0    0     0    1    1
X4   1   1  1  1      1    0     1    1    1

1 --> COLLINEARITY is detected by the test 
0 --> COLLINEARITY is not detected by the test

X1 , X2 , X3 , X4 , coefficient(s) are non-significant may be due to multicollinearity

R-square of y on all x: 0.9824 

* use method argument to check which regressors may be the reason of collinearity
===================================

Call:
imcdiag(mod = model, method = "VIF", all = TRUE)


 VIF Multicollinearity Diagnostics

        VIF detection
X1  38.4962         1
X2 254.4232         1
X3  46.8684         1
X4 282.5129         1

All Individual Multicollinearity Diagnostics in 0 or 1 

   VIF TOL Wi Fi Leamer CVIF Klein IND1 IND2
X1   1   1  1  1      0    0     0    1    1
X2   1   1  1  1      1    0     1    1    1
X3   1   1  1  1      0    0     0    1    1
X4   1   1  1  1      1    0     1    1    1

Multicollinearity may be due to X1 X2 X3 X4 regressors

1 --> COLLINEARITY is detected by the test 
0 --> COLLINEARITY is not detected by the test

===================================
       X1        X2        X3        X4 
 38.49621 254.42317  46.86839 282.51286 

mctest documentation built on July 8, 2020, 6:55 p.m.