Debian Codegraph @

man/vcovCR.rma.uni.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/rma-uni.R
3 \name{vcovCR.rma.uni}
4 \alias{vcovCR.rma.uni}
5 \title{Cluster-robust variance-covariance matrix for a rma.uni object.}
6 \usage{
7 \method{vcovCR}{rma.uni}(obj, cluster, type, target, inverse_var, form = "sandwich", ...)
8 }
9 \arguments{
10 \item{obj}{Fitted model for which to calculate the variance-covariance matrix}
11
12 \item{cluster}{Expression or vector indicating which observations
13 belong to the same cluster. Required for \code{rma.uni} objects.}
14
15 \item{type}{Character string specifying which small-sample adjustment should
16 be used, with available options \code{"CR0"}, \code{"CR1"}, \code{"CR1p"},
17 \code{"CR1S"}, \code{"CR2"}, or \code{"CR3"}. See "Details" section of
18 \code{\link{vcovCR}} for further information.}
19
20 \item{target}{Optional matrix or vector describing the working
21 variance-covariance model used to calculate the \code{CR2} and \code{CR4}
22 adjustment matrices. If not specified, the target is taken to be diagonal
23 with entries equal to the estimated marginal variance of the effect sizes.}
24
25 \item{inverse_var}{Optional logical indicating whether the weights used in
26 fitting the model are inverse-variance. If not specified, \code{vcovCR}
27 will attempt to infer a value.}
28
29 \item{form}{Controls the form of the returned matrix. The default
30 \code{"sandwich"} will return the sandwich variance-covariance matrix.
31 Alternately, setting \code{form = "meat"} will return only the meat of the
32 sandwich and setting \code{form = B}, where \code{B} is a matrix of
33 appropriate dimension, will return the sandwich variance-covariance matrix
34 calculated using \code{B} as the bread. \code{form = "estfun"} will return the
35 (appropriately scaled) estimating function, the transposed crossproduct of
36 which is equal to the sandwich variance-covariance matrix.}
37
38 \item{...}{Additional arguments available for some classes of objects.}
39 }
40 \value{
41 An object of class \code{c("vcovCR","clubSandwich")}, which consists
42 of a matrix of the estimated variance of and covariances between the
43 regression coefficient estimates.
44 }
45 \description{
46 \code{vcovCR} returns a sandwich estimate of the variance-covariance matrix
47 of a set of regression coefficient estimates from a
48 \code{\link[metafor]{rma.uni}} object.
49 }
50 \examples{
51
52 pkgs_available <-
53 requireNamespace("metafor", quietly = TRUE) &
54 requireNamespace("metadat", quietly = TRUE)
55
56 if (pkgs_available) withAutoprint({
57
58 library(metafor)
59 data(dat.assink2016, package = "metadat")
60
61 mfor_fit <- rma.uni(yi ~ year + deltype, vi = vi,
62 data = dat.assink2016)
63 mfor_fit
64
65 mfor_CR2 <- vcovCR(mfor_fit, type = "CR2", cluster = dat.assink2016$study)
66 mfor_CR2
67 coef_test(mfor_fit, vcov = mfor_CR2, test = c("Satterthwaite", "saddlepoint"))
68 Wald_test(mfor_fit, constraints = constrain_zero(2:4), vcov = mfor_CR2)
69
70 })
71
72 }
73 \seealso{
74 \code{\link{vcovCR}}
75 }