
Calculates condition indexes and variance decomposition proportions in order to test for collinearity among the independent variables of a regression model and identifies the sources of collinearity if present
colldiag(mod, scale = TRUE, center = FALSE, add.intercept = TRUE)# S3 method for colldiag
print(x,dec.places=3,fuzz=NULL,fuzzchar=".",...)
A model object or data-frame
If FALSE, the data are left unscaled. Default is TRUE
If TRUE, data are centered. Default is FALSE
if TRUE, an intercept is added. Default is TRUE
A colldiag
object
number of decimal places to use when printing
variance decomposition proportions less than fuzz are printed as fuzzchar
character for small variance decomposition proportion values
arguments to be passed on to or from other methods
A colldiag object
A vector of condition indexes
A matrix of variance decomposition proportions
print.colldiag prints the condition indexes as the first column of a table with the variance decomposition proportions beside them. print.colldiag has a fuzz option to suppress printing of small numbers. If fuzz is used, small values are replaces by a period .. Fuzzchar can be used to specify an alternative character.
Colldiag
is an implementation of the regression collinearity diagnostic procedures found in Belsley, Kuh, and Welsch (1980). These procedures examine the “conditioning” of the matrix of independent variables.
Colldiag
computes the condition indexes of the matrix. If the largest condition index (the condition number) is large (Belsley et al suggest 30 or higher), then there may be collinearity problems. All large condition indexes may be worth investigating.
Colldiag
also provides further information that may help to identify the source of these problems, the variance decomposition proportions associated with each condition index. If a large condition index is associated two or more variables with large variance decomposition proportions, these variables may be causing collinearity problems. Belsley et al suggest that a large proportion is 50 percent or more.
D. Belsley, E. Kuh, and R. Welsch (1980). Regression Diagnostics. Wiley.
Belsley, D.A. (1991). Conditioning diagnostics, collinearity and weak data in regression. New York: John Wiley & Sons.
# NOT RUN {
# Belsley (1991). "Conditioning Diagnostics"
# The Consumption Function (pp. 149-154)
data(consumption)
ct1 <- with(consumption, c(NA,cons[-length(cons)]))
# compare (5.3)
m1 <- lm(cons ~ ct1+dpi+rate+d_dpi, data = consumption)
anova(m1)
summary(m1)
# compare exhibit 5.11
with(consumption, cor(cbind(ct1, dpi, rate, d_dpi), use="complete.obs"))
# compare exhibit 5.12
cd<-colldiag(m1)
cd
print(cd,fuzz=.3)
# }
# NOT RUN {
# Example of reading UCLA data files from
# https://stats.idre.ucla.edu/r/webbook/regression-with-rchapter-4-beyond-ols/
library(foreign)
elemapi <- read.dta("https://stats.idre.ucla.edu/stat/stata/webbooks/reg/elemapi.dta")
attach(elemapi)
# Example of SAS collinearity diagnostics from
# https://stats.idre.ucla.edu/sas/webbooks/reg/
# 2.4 Tests for Collinearity
m2 <- lm(api00 ~ acs_k3+avg_ed+grad_sch+col_grad+some_col)
summary(m2)
library(car)
vif(m2)
library(perturb)
cd2<-colldiag(m2,add.intercept=FALSE,center=TRUE)
print(cd2,dec.places=5)
# }
Run the code above in your browser using DataLab