Plot method for objects of class "vif.rma".

# S3 method for vif.rma
plot(x, breaks="Scott", freq=FALSE, col="gray", border="white", trim=0,
col.out=rgb(1,0,0,0.5), col.density="blue", adjust=1, lwd=c(2,0), layout, ...)

## Arguments

x

an object of class "vif.rma" obtained with vif.

breaks

argument to be passed on to the corresponding argument of hist to set (the method for determining) the (number of) breakpoints.

freq

logical to indicate whether frequencies or probability densities should be plotted (the default is FALSE to plot densities).

col

character string to specify the color for the bars (the default is gray).

border

character string to specify the color for the border around the bars (the default is white).

trim

the fraction (up to 0.5) of observations to be trimmed from the upper tail of each distribution before its histogram is plotted.

col.out

character string to specify the color for the bars that are more extreme than the observed (G)VIF value (the default is a semi-transparent shade of red).

col.density

character string to specify the color of the kernel density estimate of the distribution that is superimposed on top of the histogram (the default is blue).

numeric value to be passed on to the corresponding argument of density (for adjusting the bandwidth of the kernel density estimate).

lwd

numeric vector to specify the width of the vertical lines corresponding to the value of the observed (G)VIFs and of the density estimate (note: by default, the density estimate has a line width of 0 and is therefore not plotted).

layout

optional vector of two numbers to specify the number of rows and columns for the layout of the figure.

...

other arguments.

## Details

The function plots the distribution of each (G)VIF as simulated under independence as a histogram.

Arguments breaks, freq, col, and border are passed on to the hist function for the plotting.

Argument trim can be used to trim away a certain fraction of observations from the upper tail of each distribution before its histogram is plotted. By setting this to a value above 0, one can quickly remove some of the extreme values that might lead to the bulk of the distribution getting squished together at the left (typically, a small value such as trim=.01 is sufficient for this purpose).

The observed (G)VIF value is indicated as a vertical dashed line. If the observed exceeds the upper plot limit, then this is indicated by an arrow pointing to the line.

Argument col.out is used to specify the color for the bars in the histogram that are more extreme than the observed (G)VIF value.

A kernel density estimate of the distribution can be superimposed on top of the histogram (as a smoothed representation of the distribution). Note that the kernel density estimate of the distribution is only shown when setting the line width for this element greater than 0 via the lwd argument (e.g., lwd=c(2,2)).

## Author

Wolfgang Viechtbauer wvb@metafor-project.org https://www.metafor-project.org

## References

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

vif.rma for the function to create vif.rma objects.

## Examples

### 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.

### use the simulation approach to analyze the size of the VIFs
# \dontrun{
vifs <- vif(res, sim=TRUE)
vifs
#>
#>              vif  prop
#> length    1.5371  0.96
#> wic       1.3860  0.87
#> feedback  1.6490  0.99
#> info      1.8340  0.98
#> pers      5.6780  1.00
#> imag      1.1554  0.48
#> meta      4.5333  1.00
#>

### plot the simulated distributions of the VIFs
plot(vifs)

### add densities, trim away some extremes, and set break points