Description Usage Arguments Details Examples

Calculates versions of the variance-inflation and generalized variance-inflation factors for mixed models.

1 | ```
vif.lme(mod)
``` |

`mod` |

The concept of Variance Inflation in linear models can be applied to mixed models in a
number of ways since the variance-covariance matrix of the estimated fixed coefficients is not
simply proportional to the inverse of the cross-product matrix for the data. This
method for the generic function `vif`

in the `car`

package, implements the version
based on the variance-covariance funtion of the estimated fixed coefficients. Since the `vcov`

method is available for `lm`

objects and `lme`

objects, uses the code for
the `lm`

method for `lme`

objects.

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 | ```
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (mod)
{
if (any(is.na(fixef(mod))))
stop("there are aliased coefficients in the model")
v <- vcov(mod)
mm <- model.matrix(formula(mod), mod$data)
assign <- attributes(mm)$assign
if (names(fixef(mod)[1]) == "(Intercept)") {
v <- v[-1, -1]
assign <- assign[-1]
}
else warning("No intercept: vifs may not be sensible.")
terms <- labels(terms(mod))
n.terms <- length(terms)
if (n.terms < 2)
stop("model contains fewer than 2 terms")
R <- cov2cor(v)
detR <- det(R)
result <- matrix(0, n.terms, 3)
rownames(result) <- terms
colnames(result) <- c("GVIF", "Df", "GVIF^(1/2Df)")
for (term in 1:n.terms) {
subs <- which(assign == term)
result[term, 1] <- det(as.matrix(R[subs, subs])) * det(as.matrix(R[-subs,
-subs]))/detR
result[term, 2] <- length(subs)
}
if (all(result[, 2] == 1))
result <- result[, 1]
else result[, 3] <- result[, 1]^(1/(2 * result[, 2]))
result
}
``` |

gmonette/spida documentation built on May 17, 2019, 7:25 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.