Description Usage Arguments Details Value Note Author(s) References See Also Examples
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
1 2 3 4 |
mod |
A model object or data-frame |
scale |
If FALSE, the data are left unscaled. Default is TRUE |
center |
If TRUE, data are centered. Default is FALSE |
add.intercept |
if TRUE, an intercept is added. Default is TRUE |
x |
A |
dec.places |
number of decimal places to use when printing |
fuzz |
variance decomposition proportions less than fuzz are printed as fuzzchar |
fuzzchar |
character for small variance decomposition proportion values |
... |
arguments to be passed on to or from other methods |
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.
A colldiag object
condindx |
A vector of condition indexes |
pi |
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 based on the Stata program coldiag
by Joseph Harkness joe.harkness@jhu.edu, Johns Hopkins University.
John Hendrickx John_Hendrickx@yahoo.com
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.
lm
, scale
, svd
, [car]
vif
, [rms]
vif
, perturb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # 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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.