Debian Codegraph @

man/vcovCR.geeglm.Rd

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