vif.ridge: Variance Inflation Factors for Ridge Regression

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

View source: R/vif.ridge.R

Description

The function vif.ridge calculates variance inflation factors for the predictors in a set of ridge regression models indexed by the tuning/shrinkage factor.

Usage

1
2
## S3 method for class 'ridge'
vif(mod, ...)

Arguments

mod

A ridge object

...

Other arguments (unused)

Details

Variance inflation factors are calculated using the simplified formulation in Fox & Monette (1992).

Value

Returns a matrix of variance inflation factors of the same size and shape as coef{mod}. The columns correspond to the predictors in the model and the rows correspond to the values of lambda in ridge estimation.

Author(s)

Michael Friendly

References

Fox, J. and Monette, G. (1992). Generalized collinearity diagnostics. JASA, 87, 178-183

See Also

vif, precision

Examples

 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
40
41
42
43
data(longley)
lmod <- lm(Employed ~ GNP + Unemployed + Armed.Forces + Population + 
                      Year + GNP.deflator, data=longley)
vif(lmod)

longley.y <- longley[, "Employed"]
longley.X <- data.matrix(longley[, c(2:6,1)])

lambda <- c(0, 0.005, 0.01, 0.02, 0.04, 0.08)
lridge <- ridge(longley.y, longley.X, lambda=lambda)
coef(lridge)


vridge <- vif(lridge)
vridge

# plot VIFs
pch <- c(15:18, 7, 9)
clr <- c("black", rainbow(5, start=.6, end=.1))

matplot(rownames(vridge), vridge, type='b', 
	xlab='Ridge constant (k)', ylab="Variance Inflation", 
	xlim=c(0, 0.08), 
	col=clr, pch=pch, cex=1.2)
text(0.0, vridge[1,], colnames(vridge), pos=4)

matplot(lridge$df, vridge, type='b', 
	xlab='Degrees of freedom', ylab="Variance Inflation", 
	col=clr, pch=pch, cex=1.2)
text(6, vridge[1,], colnames(vridge), pos=2)

# more useful to plot VIF on the sqrt scale

matplot(rownames(vridge), sqrt(vridge), type='b', 
	xlab='Ridge constant (k)', ylab=expression(sqrt(VIF)), 
	xlim=c(-0.01, 0.08), 
	col=clr, pch=pch, cex=1.2, cex.lab=1.25)
text(-0.01, sqrt(vridge[1,]), colnames(vridge), pos=4, cex=1.2)

matplot(lridge$df, sqrt(vridge), type='b', 
	xlab='Degrees of freedom', ylab=expression(sqrt(VIF)), 
	col=clr, pch=pch, cex=1.2, cex.lab=1.25)
text(6, sqrt(vridge[1,]), colnames(vridge), pos=2, cex=1.2)

genridge documentation built on May 2, 2019, 5:46 p.m.