# vif

##### Calculate the Variance Inflation Factor

The VIF for predictor \(i\) is \(1/(1-R_i^2)\), where \(R_i^2\) is the \(R^2\) from a regression of predictor \(i\) against the remaining predictors.

- Keywords
- regression

##### Usage

`vif(xx, ...)`# S3 method for default
vif(xx, y.name, na.action = na.exclude, ...) ## xx is a data.frame

# S3 method for formula
vif(xx, data, na.action = na.exclude, ...) ## xx is a formula

# S3 method for lm
vif(xx, na.action = na.exclude, ...) ## xx is a "lm" object computed with x=TRUE

##### Arguments

- xx
`data.frame`

, or`formula`

, or`lm`

object computed with`x=TRUE`

.- na.action
See

`na.action`

.- …
additional arguments.

- y.name
Name of Y-variable to be excluded from the computations.

- data
A data frame in which the variables specified in the formula will be found. If missing, the variables are searched for in the standard way.

##### Details

A simple diagnostic of collinearity is the
*variance inflation factor, VIF*
one for each regression coefficient (other than the intercept).
Since the condition of collinearity involves the predictors but not
the response, this measure is a function of the \(X\)'s but not of \(Y\).
The VIF for predictor \(i\) is \(1/(1-R_i^2)\), where \(R_i^2\) is the
\(R^2\) from a regression of predictor \(i\) against the remaining
predictors. If \(R_i^2\) is close to 1, this means that predictor \(i\)
is well explained by a linear function of the remaining predictors,
and, therefore, the presence of predictor \(i\) in the model is
redundant. Values of VIF exceeding 5 are considered evidence of
collinearity: The information carried by a predictor having such a VIF
is contained in a subset of the remaining predictors. If, however,
all of a model's regression coefficients differ significantly from 0
(\(p\)-value \(<\) .05), a somewhat larger VIF may be tolerable.

##### Value

Vector of VIF values, one for each X-variable.

##### References

Heiberger, Richard M. and Holland, Burt (2015).
*Statistical Analysis and Data Display: An Intermediate Course with Examples in R*.
Second Edition.
Springer-Verlag, New York.
https://www.springer.com/us/book/9781493921218

##### See Also

`lm`

.

##### Examples

```
# NOT RUN {
data(usair)
usair$lnSO2 <- log(usair$SO2)
usair$lnmfg <- log(usair$mfgfirms)
usair$lnpopn <- log(usair$popn)
usair.lm <- lm(lnSO2 ~ temp + lnmfg + wind + precip, data=usair, x=TRUE)
vif(usair.lm) ## the lm object must be computed with x=TRUE
vif(lnSO2 ~ temp + lnmfg + wind + precip, data=usair)
vif(usair)
vif(usair, y.name="lnSO2")
# }
```

*Documentation reproduced from package HH, version 3.1-42, License: GPL (>= 2)*