# Regression - Diagnostic - Multicollinearity Table (VIF) extension

Create a table containing variance inflation factors (VIF) to diagnose multicollinearity

Computes the variance inflation factors (VIF) of linear models and generalized variance-inflation factors (GCIF) for generalized linear models. See the blog for an introduction to VIFs.

## Example

The below table contains the output from running this QScript on a Regression - Binary Logitbinary logit output.

## Technical details

A score of 10 or above indicates high multicollinearity.

## Acknowledgements

Uses the vif function from the car package.

## References

Fox, J., & Monette, G. (1992). Generalized collinearity diagnostics. Journal of the American Statistical Association, 87(417), 178-183.

Bock, T. (2018, April 6). What are Variance Inflation Factors (VIFs)? [Blog post]. Retrieved from https://www.displayr.com/variance-inflation-factors-vifs/.

## Code

```includeWeb("QScript R Output Functions");

var is_displayr = (!!Q.isOnTheWeb && Q.isOnTheWeb());
if (!is_displayr)
{
if (Q.fileFormatVersion() >= 17.13)
main();
else
alert("Please update Q to use this feature from the extension button, or run it from the menu via Create > Regression > Diagnostic > Multicollinearity (VIF).");
}
else
{
main();
}

function main() {

// The following 2 variables contain information specific to this diagnostic.
var required_class = "Regression";
var output_name_suffix = "multicolinearity";

var item = checkSelectedItemClass(required_class);
if (item == null)
return false;
var r_name = stringToRName(item.referenceName);

// The following lines contain the R code to run
var expression = "car::vif(" + r_name + ")"

return createROutput(item, expression, output_name_suffix);
}
```