vcov.rma {metafor} | R Documentation |
The function extracts various types of variance-covariance matrices from objects of class "rma"
. By default, the variance-covariance matrix of the parameter estimates (fixed effects) is returned.
## S3 method for class 'rma' vcov(object, type="fixed", ...)
object |
an object of class |
type |
character string to specify the type of variance-covariance matrix to return: |
... |
other arguments. |
Note that type="obs"
currently only works for object of class "rma.uni"
and "rma.mv"
.
For objects of class "rma.uni"
, the marginal variance-covariance matrix of the observed effect sizes or outcomes is just a diagonal matrix with \(\hat{\tau}^2 + v_i\) along the diagonal, where \(\hat{\tau}^2\) is the estimated amount of (residual) heterogeneity (set to 0 in equal-effects models) and \(v_i\) is the sampling variance of the \(i\textrm{th}\) study.
For objects of class "rma.mv"
, the structure can be more complex and depends on the random effects included in the model.
A matrix corresponding to the requested variance-covariance matrix.
Wolfgang Viechtbauer wvb@metafor-project.org https://www.metafor-project.org
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
rma.uni
, rma.mh
, rma.peto
, rma.glmm
, and rma.mv
for functions to fit models for which the various types of variance-covariance matrices can be extracted.
### calculate log risk ratios and corresponding sampling variances dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg) ### fit mixed-effects model with absolute latitude and publication year as moderators res <- rma(yi, vi, mods = ~ ablat + year, data=dat) ### var-cov matrix of the fixed effects (i.e., the model coefficients) vcov(res) ### marginal var-cov matrix of the observed log risk ratios round(vcov(res, type="obs"), 3) ### var-cov matrix of the fitted values round(vcov(res, type="fitted"), 3) ### var-cov matrix of the residuals round(vcov(res, type="resid"), 3)