`vif.Rd`

Compute variance inflation factors (VIFs) for objects of class `"rma"`

.

```
vif(x, ...)
# S3 method for rma
vif(x, btt, intercept=FALSE, table=FALSE, digits, ...)
# S3 method for vif.rma
print(x, digits=x$digits, ...)
```

- x
an object of class

`"rma"`

(for`vif`

) or`"vif.rma"`

(for`print`

).- btt
optional vector of indices to specify a set of coefficients for which a generalized variance inflation factor (GVIF) should be computed. Can also be a string to

`grep`

for. See ‘Details’.- intercept
logical to specify whether to include the intercept (if the model includes one) in the computation of the VIFs (the default is

`FALSE`

). See ‘Note’.- table
logical to specify whether the VIFs should be added to the model coefficient table (the default is

`FALSE`

).- digits
optional integer to specify the number of decimal places to which the printed results should be rounded. If unspecified, the default is to take the value from the object.

- ...
other arguments.

The function computes variance inflation factors (VIFs) for meta-regression models. Hence, the model specified via argument `x`

must include moderator variables (and more than one for this to be useful, as the VIF for a model with a single moderator variable will always be equal to 1).

Let \(b_j\) denote the estimate of the \(j\textrm{th}\) model coefficient of a particular meta-regression model and \(\mbox{Var}[b_j]\) its variance (i.e., the corresponding diagonal element from the matrix obtained with the `vcov`

function). Moreover, let \(b'_j\) denote the estimate of the same model coefficient if the other moderator variables in the model had *not* been included in the model and \(\mbox{Var}[b'_j]\) the corresponding variance. Then the VIF for the model coefficient is given by \[\mbox{VIF}[b_j] = \frac{\mbox{Var}[b_j]}{\mbox{Var}[b'_j]},\] which indicates the inflation in the variance of the estimated model coefficient due to potential collinearity of the \(j\textrm{th}\) moderator variable with the other moderator variables in the model. Taking the square root of a VIF gives the corresponding standard error inflation factor (SIF).

If `btt`

is not specified, then the VIF is computed for each individual model coefficient. However, if the model includes factors (coded in terms of multiple dummy variables) or other sets of moderator variables that belong together (e.g., for polynomials or cubic splines), one may want to examine how much the variance in all of the coefficients in the set is jointly impacted by collinearity with the other moderator variables in the model. For this, we can compute a generalized variance inflation factor (GVIF) (Fox & Monette, 1992) by setting the `btt`

argument equal to the indices of those coefficients for which the GVIF should be computed. The square root of a GVIF indicates the inflation in the confidence ellipse/(hyper)ellipsoid for the set of coefficients corresponding to the set due to collinearity. However, to make this value more directly comparable to SIFs (based on single coefficients) or when the set includes a different number of coefficients, the function computes the generalized standard error inflation factor (GSIF) by raising the GVIF to the power of \(1/(2m)\) (where \(m\) denotes the number of coefficients in the set).

If `btt`

is not specified, either a vector (if `table=FALSE`

) with the VIFs or a data frame (if `table=TRUE`

) with the following elements:

- estimate
estimated model coefficients.

- se
corresponding standard errors.

- zval
corresponding test statistics.

- pval
corresponding p-values.

- ci.lb
corresponding lower bound of the confidence intervals.

- ci.ub
corresponding upper bound of the confidence intervals.

- vif
corresponding variance inflation factors.

- sif
corresponding standard error inflation factors.

If `btt`

is specified, a list with elements `gvif`

and `gsif`

with the GVIF and GSIF values for the set of coefficients specified.

The values of the (G)VIFs are invariant to the scaling of the predictor variables if the model includes an intercept that is removed when inverting the correlation matrix of the model coefficients to compute the (G)VIFs. This is the default behavior. See ‘Examples’.

Belsley, D. A., Kuh, E., & Welsch, R. E. (1980). *Regression diagnostics*. New York: Wiley.

Fox, J., & Monette, G. (1992). Generalized collinearity diagnostics. *Journal of the American Statistical Association*, **87**(417), 178-183. https://doi.org/10.2307/2290467

Stewart, G. W. (1987). Collinearity and least squares regression. *Statistical Science*, **2**(1), 68-84. https://doi.org/10.1214/ss/1177013439

Wax, Y. (1992). Collinearity diagnosis for a relative risk regression-analysis: An application to assessment of diet cancer relationship in epidemiologic studies. *Statistics in Medicine*, **11**(10), 1273–1287. https://doi.org/10.1002/sim.4780111003

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. *Journal of Statistical Software*, **36**(3), 1–48. https://doi.org/10.18637/jss.v036.i03

```
### copy data from Bangert-Drowns et al. (2004) into 'dat'
dat <- dat.bangertdrowns2004
### fit mixed-effects meta-regression model
res <- rma(yi, vi, mods = ~ length + wic + feedback + info + pers + imag + meta, data=dat)
#> Warning: Studies with NAs omitted from model fitting.
### get variance inflation factors
vif(res)
#>
#> length wic feedback info pers imag meta
#> 1.5371 1.3860 1.6490 1.8340 5.6780 1.1554 4.5333
#>
### show that VIFs are not influenced by scaling of the predictors
u <- scale # to standardize the predictors
res <- rma(yi, vi, mods = ~ u(length) + u(wic) + u(feedback) + u(info) +
u(pers) + u(imag) + u(meta), data=dat)
#> Warning: Studies with NAs omitted from model fitting.
vif(res)
#>
#> u(length) u(wic) u(feedback) u(info) u(pers) u(imag) u(meta)
#> 1.5371 1.3860 1.6490 1.8340 5.6780 1.1554 4.5333
#>
### get full table
vif(res, table=TRUE)
#>
#> estimate se zval pval ci.lb ci.ub vif sif
#> intrcpt 0.1825 0.0406 4.4898 <.0001 0.1028 0.2621 NA NA
#> u(length) 0.0458 0.0496 0.9240 0.3555 -0.0514 0.1431 1.5371 1.2398
#> u(wic) -0.0210 0.0487 -0.4308 0.6666 -0.1164 0.0744 1.3860 1.1773
#> u(feedback) 0.0329 0.0524 0.6265 0.5310 -0.0699 0.1357 1.6490 1.2842
#> u(info) -0.0460 0.0418 -1.1006 0.2711 -0.1280 0.0360 1.8340 1.3542
#> u(pers) -0.0573 0.0956 -0.5992 0.5490 -0.2446 0.1301 5.6780 2.3829
#> u(imag) 0.1004 0.0452 2.2233 0.0262 0.0119 0.1890 1.1554 1.0749
#> u(meta) 0.0981 0.0850 1.1537 0.2486 -0.0685 0.2647 4.5333 2.1291
#>
### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
### fit meta-regression model where one predictor (alloc) is a three-level factor
res <- rma(yi, vi, mods = ~ ablat + alloc, data=dat)
### get variance inflation factors for all individual coefficients
vif(res, table=TRUE)
#>
#> estimate se zval pval ci.lb ci.ub vif sif
#> intrcpt 0.2932 0.4050 0.7239 0.4691 -0.5006 1.0870 NA NA
#> ablat -0.0273 0.0092 -2.9650 0.0030 -0.0453 -0.0092 1.0151 1.0075
#> allocrandom -0.2675 0.3504 -0.7633 0.4453 -0.9543 0.4193 1.7224 1.3124
#> allocsystematic 0.0585 0.3795 0.1540 0.8776 -0.6854 0.8023 1.7111 1.3081
#>
### generalized variance inflation factor for the 'alloc' factor
vif(res, btt=3:4)
#>
#> Collinearity Diagnostics (coefficients 3:4):
#> GVIF = 1.0151, GSIF = 1.0038
#>
### can also specify a string to grep for
vif(res, btt="alloc")
#>
#> Collinearity Diagnostics (coefficients 3:4):
#> GVIF = 1.0151, GSIF = 1.0038
#>
```