Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

vcov.rma

Extract Various Types of Variance-Covariance Matrices from 'rma' Objects


Description

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.

Usage

## S3 method for class 'rma'
vcov(object, type="fixed", ...)

Arguments

object

an object of class "rma".

type

character string indicating the type of variance-covariance matrix to return; type="fixed" returns the variance-covariance matrix of the fixed effects (the default), type="obs" returns the marginal variance-covariance matrix of the observed effect sizes or outcomes, type="fitted" returns the variance-covariance matrix of the fitted values, type="resid" returns the variance-covariance matrix of the residuals.

...

other arguments.

Details

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 is just a diagonal matrix with τ² + vᵢ along the diagonal, where τ² is the estimated amount of (residual) heterogeneity (set to 0 in fixed-effects models) and vᵢ is the sampling variance of the ith study.

For objects of class "rma.mv", the structure can be more complex and depends on the types of random effects included in the model.

Value

A matrix corresponding to the requested variance-covariance matrix.

Author(s)

References

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

See Also

Examples

### meta-analysis of the log risk ratios using a mixed-effects model
### with two moderators (absolute latitude and publication year)
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg,
           mods = ~ ablat + year, data=dat.bcg)
vcov(res)

### marginal var-cov matrix of the observed log risk ratios
vcov(res, type="obs")

### var-cov matrix of the fitted values
vcov(res, type="fitted")

### var-cov matrix of the residuals
vcov(res, type="resid")

metafor

Meta-Analysis Package for R

v2.4-0
GPL (>= 2)
Authors
Wolfgang Viechtbauer [aut, cre] (<https://orcid.org/0000-0003-3463-4063>)
Initial release
2020-03-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.