Regression - Diagnostic - Multicollinearity (VIF)

From Q
Jump to: navigation, search

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 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");

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);
}