weights.rma | R Documentation |
Functions to compute the weights given to the observed effect sizes or outcomes during the model fitting for objects of class "rma.uni"
, "rma.mh"
, "rma.peto"
, and "rma.mv"
.
## S3 method for class 'rma.uni'
weights(object, type="diagonal", ...)
## S3 method for class 'rma.mh'
weights(object, type="diagonal", ...)
## S3 method for class 'rma.peto'
weights(object, type="diagonal", ...)
## S3 method for class 'rma.glmm'
weights(object, ...)
## S3 method for class 'rma.mv'
weights(object, type="diagonal", ...)
object |
an object of class |
type |
character string to specify whether to return only the diagonal of the weight matrix ( |
... |
other arguments. |
Either a vector with the diagonal elements of the weight matrix or the entire weight matrix. When only the diagonal elements are returned, they are given in % (and they add up to 100%).
When the entire weight matrix is requested, this is always a diagonal matrix for objects of class "rma.uni"
, "rma.mh"
, "rma.peto"
.
For "rma.mv"
, the structure of the weight matrix depends on the model fitted (i.e., the random effects included and the variance-covariance matrix of the sampling errors) but is often more complex and not just diagonal.
For intercept-only "rma.mv"
models, one can also take the sum over the rows in the weight matrix, which are actually the weights assigned to the observed effect sizes or outcomes when estimating the model intercept. These weights can be obtained with type="rowsum"
(as with type="diagonal"
, they are also given in %). See here for a discussion of this.
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
Viechtbauer, W. (2021). Model checking in meta-analysis. In C. H. Schmid, T. Stijnen, & I. R. White (Eds.), Handbook of meta-analysis (pp. 219–254). Boca Raton, FL: CRC Press. https://doi.org/10.1201/9781315119403
rma.uni
, rma.mh
, rma.peto
, and rma.mv
for functions to fit models for which model fitting weights can be extracted.
influence.rma.uni
and influence.rma.mv
for other model diagnostics.
### 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)
### extract the model fitting weights (in %)
weights(res)
### extract the weight matrix
round(weights(res, type="matrix"), 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.