geem2 {mmmgee} | R Documentation |
Fit Generalized Estimating Equation Models
Description
geem2
is a modified version of geem
to fit generalized estimating equation models and to provide objects that can be used
for simultaneous inference across multiple marginal models using mmmgee
and mmmgee.test
.
Like geem
, geem2
estimates coefficients and nuisance parameters using generalized estimating equations. The link and variance functions can be
specified by the user and the syntax is similar to glm
.
Usage
geem2(formula, id, waves = NULL, data = parent.frame(),
family = gaussian, corstr = "independence", Mv = 1,
weights = NULL, corr.mat = NULL, init.beta = NULL,
init.alpha = NULL, init.phi = 1, scale.fix = FALSE,
nodummy = FALSE, sandwich = TRUE, useP = TRUE, maxit = 20,
tol = 1e-05, restriction = NULL, conv.criterion = c("ratio",
"difference"))
Arguments
formula |
a formula expression similar to that for |
id |
a vector identifying the clusters. By default, data are assumed to be sorted such that observations in a cluster are in consecutive rows and higher
numbered rows in a cluster are assumed to be later. If |
waves |
a non-negative integer vector identifying components of a cluster. For example, this could be a time ordering. If integers are skipped within a cluster,
then dummy rows with weight 0 are added in an attempt to preserve the correlation structure (except if |
data |
an optional data frame containing the variables in the model. |
family |
will determine the link and variance functions. The argument can be one of three options: a family object, a character string, or a list of functions.
For more information on how to use family objects, see |
corstr |
a character string specifying the correlation structure. Allowed structures are: |
Mv |
for |
weights |
A vector of weights for the inverse of the scale factor each observation.
If an observation is assigned weight 0, it is excluded from the calculations of any parameters.
Observations with a |
corr.mat |
the correlation matrix for |
init.beta |
an optional vector with the initial values of beta. If not specified, then the intercept will be set to |
init.alpha |
an optional scalar or vector giving the initial values for the correlation. If provided along with |
init.phi |
an optional initial scale parameter. If not supplied, initialized to 1. |
scale.fix |
if set to |
nodummy |
if set to |
sandwich |
if |
useP |
if set to |
maxit |
maximum number of iterations. |
tol |
tolerance in calculation of coefficients. |
restriction |
either a contrast matrix or a list of a contrast matrix and a right hand side vector, defining a restriction on the regression coefficients. See details. |
conv.criterion |
convergence criterion, either |
Details
The function is a modification of geem
from the geeM package, such that
additional output is returned that is required for the calculation of covariance
matrix across multiple marginal models. In particular the contributions of each subject to the estimating equation are made available in the output. Internal functions regarding
the calculation of matrix inverses were modified to improve the handling of missing data.
In geem2
, weights are defined as scale weights, similar to most othe software. Note that, in contrast, the current version of geem
(version 0.10.1) uses
residual weights.
The scale parameter phi
is used in estimating the residual working correlation parameters and in estimating the model based (naiv) covariance matrix of the regression coefficients.
Similar as in most other software, requesting scale.fix=TRUE
only has an impact on the latter, while the working correlation is still estimated using an empirical
scale factor for the residuals. In contrast, geem
uses the fixed scale factor also when estimating the working correlation.
geem2
allows for estimation of regression coefficients under linear restrictions L\beta=r
, where L
is a contrast matrix, \beta
the vector of regression coefficients and r
a real valued right hand side vector. Using the argument restriction
, L
and r
can be specified.
If only L
is specified, r
is assumed as null vector. The functionality is in particular required to calculate the generalized score test for linear hypotheses about
\beta
. Use conv.criterion="difference"
if any regression coefficient is restricted to 0.
Value
A list with class geem2
, similar to the output
of geem
from the geeM package. The additional slot sandwich.args
contains components to calculate the sandwich variance estimator for the
fitted model and across models if
applied in the multiple marginal model framework.
Note
The option to fit a model with linear restrictions concerning the coefficients is implemented to enable the calculation of a generalized score test.
It may also be used to obtain estimates of the coefficients under restrictions. The model based and robust variance estimates of the restricted
coefficient estimates are found in the slots restricted.naiv.var
and restricted.var
, respectively. Note that the variance of estimates restricted to a single value
is supposed to be zero, however the calculated variance estimate may deviate from zero within machine accuracy.
Author(s)
The geem
function was written by Lee McDaniel and Nick Henderson, modifications for geem2
are by Robin Ristl robin.ristl@meduniwien.ac.at
References
Lee S. McDaniel, Nicholas C. Henderson, Paul J. Rathouz. Fast pure R implementation of GEE: application of the matrix package. The R journal 5.1 (2013): 181.
See Also
Examples
data(keratosis)
m1<-geem2(clearance~trt,id=id,data=keratosis,family=binomial,corstr="independence")
summary(m1)
m2<-geem2(pain~trt,id=id,data=keratosis[keratosis$lesion==1,],family=gaussian,corstr="independence")
summary(m2)
geem2(pain~trt,id=id,data=keratosis[keratosis$lesion==1,],family=gaussian,corstr="exchangeable")
#
data(datasim)
mod1<-geem2(Y.lin~gr.lang+x1,id=id,data=datasim,family="gaussian",corstr="exchangeable")
summary(mod1)
mod2<-geem2(Y.poi~gr.lang+x2,id=id,data=datasim,family="poisson",corstr="unstructured")
summary(mod2)
mod3<-geem2(Y.bin~gr.lang+x3,id=id,data=datasim,family="binomial",corstr="user",
corr.mat=matrix(c(1,2,3,0, 2,1,2,3, 3,2,1,2, 0,3,2,1),4,4))
summary(mod3)