plot.vif.rma {metafor} | R Documentation |
Plot Method for 'vif.rma' Objects
Description
Plot method for objects of class "vif.rma"
.
Usage
## S3 method for class 'vif.rma'
plot(x, breaks="Scott", freq=FALSE, col, border, col.out, col.density,
trim=0, adjust=1, lwd=c(2,0), layout, ...)
Arguments
x |
an object of class |
breaks |
argument to be passed on to the corresponding argument of |
freq |
logical to indicate whether frequencies or probability densities should be plotted (the default is |
col |
optional character string to specify the color of the histogram bars. |
border |
optional character string to specify the color of the borders around the bars. |
col.out |
optional character string to specify the color of the bars that are more extreme than the observed (G)VIF value (the default is a semi-transparent shade of red). |
col.density |
optional 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). |
trim |
the fraction (up to 0.5) of observations to be trimmed from the upper tail of each distribution before its histogram is plotted. |
adjust |
numeric value to be passed on to the corresponding argument of |
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=0.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(s)
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
See Also
vif
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)
### use the simulation approach to analyze the size of the VIFs
## Not run:
vifs <- vif(res, sim=TRUE, seed=1234)
vifs
### plot the simulated distributions of the VIFs
plot(vifs)
### add densities, trim away some extremes, and set break points
plot(vifs, lwd=c(2,2), trim=0.01, breaks=seq(1,2.2,by=0.05), adjust=1.5)
## End(Not run)