[R-meta] Variance inflation factors (VIF) calculations applicable to a rma.mv model
Martineau, Roger
Roger@M@rtine@u @ending from AGR@GC@CA
Thu May 31 21:31:27 CEST 2018
Dear list members,
I have the following multilevel model. I want to calculate variance inflation factors (VIF) among Xs to test collinearity.
Does someone know how to get VIF from a rma.mv model ?
> model19 <- rma.mv(MPY, SEM^2, data=dataset,
+ mods = ~
+ X1 +
+ X2 +
+ X3 +
+ X4 +
+ X5,
+ random = ~ 1|experiment/study/ID,
+ method = "REML", digits=4)
> robust(model19, cluster= dataset$experiment)
I have this VIF function that I can use for a lmer model (see below) but it doesn’t work for the rma.mv model.
# VIF for lmer model
vif.mer <- function (fit) {
v <- vcov(fit)
nam <- names(fixef(fit))
ns <- sum(1 * (nam == "Intercept" | nam == "(Intercept)"))
if (ns > 0) {
v <- v[-(1:ns), -(1:ns), drop = FALSE]
nam <- nam[-(1:ns)]
}
d <- diag(v)^0.5
v <- diag(solve(v/(d %o% d)))
names(v) <- nam
v
}
Best,
Roger ☺
Roger Martineau, mv Ph.D.
Centre de recherche et de développement
sur le bovin laitier et le porc
Agriculture et agroalimentaire Canada/Agriculture and Agri-Food Canada
Téléphone/Telephone: 819-780-7319
Télécopieur/Facsimile: 819-564-5507
2000, Rue Collège / 2000, College Street
Sherbrooke (Québec) J1M 0C8
Canada
roger.martineau using agr.gc.ca<mailto:roger.martineau using agr.gc.ca>
[[alternative HTML version deleted]]
More information about the R-sig-meta-analysis
mailing list