getCoeffTolerance | R Documentation |
Calculates the varience inflation factors (VIF) for linear and generalized linear models, returning the tolerance (1/VIF).
getCoeffTolerance(mod)
mod |
A lm or glm object. |
Tolerance is 1/VIF. VIF is a measure of multicolinearity. See https://en.wikipedia.org/wiki/Variance_inflation_factor for more details.
This function relies on the getVif
function which has been adpated from car::vif
. When there are categorical/factor variables in the regresion, the car
version returns one value for categorical variable as a whole, hence the resulting vector is a different length to the coefficient table.
This function simple expands that result so it can be added to the coefficient table.
For more details on the vif calculation see vif
in the car
package.
# Running a linear regression on the mtcars data set...
# ...predicting miles per gallon
m1 = lm( mpg ~ cyl + disp + hp + gear + carb + gear*carb,data=mtcars)
tol = getCoeffTolerance(m1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.