drgeeData {drgee} | R Documentation |
Extracting Variables and Model Matrices for Generalized Estimating equations
Description
Given a main model, an outcome nuisance model and an
exposure nuisance model drgeeData
extracts the model
variables and matrices from a data.frame
or an environment
object. It also performs some data cleaning and error checking.
Usage
drgeeData(outcome, exposure,
oformula, eformula, iaformula = formula(~1),
olink = c("identity", "log", "logit"),
elink = c("identity", "log", "logit"),
data, subset = NULL,
estimation.method = c("dr", "o", "e"),
cond = FALSE, clusterid, clusterid.vcov)
Arguments
outcome |
The outcome as a variable or as a character string naming a variable in the
|
exposure |
The exposure as a variable or as a character string naming a variable in the
|
oformula |
An expression or formula for the outcome nuisance model. The outcome is identified as the response in this formula. |
eformula |
An expression or formula for the exposure nuisance model. The exposure is identified as the response in this formula. |
iaformula |
An expression or formula where the RHS should contain the variables
that "interact" (i.e. are supposed to be multiplied with) with the
exposure in the main model to create the terms associated with the
parameters of interest. "1" will always added. Default value is no
interactions, i.e. |
olink |
A character string naming the link function in the outcome nuisance
model. Have to be |
elink |
A character string naming the link function in the exposure nuisance
model. Have to be |
data |
A data frame or environment containing the variables in |
subset |
An optional vector defining a subset of the data to be used. |
estimation.method |
A character string naming the desired estimation method. Choose
|
cond |
A logical value indicating whether the nuisance models should have
cluster-specific intercepts. If |
clusterid |
A cluster-defining variable or a character string naming a cluster-defining variable in the
|
clusterid.vcov |
A cluster-defining variable or a character string naming a
cluster-defining variable in the |
Details
drgeeData
is called by drgee
and gee
to extract
data from a data.frame
or environment
object. The data can then be used to for O-estimation, E-estimation or
DR-estimation. drgeeData
uses
model.frame
and model.matrix
to remove incomplete
observations and to convert factors to dummy variables. It also
performs check the supplied data for errors or inconsistencies.
The class method summary.drgeeData
produces strings for the
formulas with terms referring to the columns in the produced design
matrices.
Value
drgee.data
returns an object of class drgeeData
containing
used.rows |
The rows numbers in the original data for the used rows (after subset selection and exlusions). |
orig.order |
The original order of the observations. |
y |
The outcome matrix. |
a |
The exposure matrix. |
x |
The matrix of of interactions defined in |
ax |
The matrix of elementwise product(s) of |
v |
The matrix of terms in the outcome nuisance model. |
z |
The matrix of terms in the exposure nuisance model. |
yx |
The matrix of elementwise product(s) of |
id |
A factor defining clusters. For independent observations, the number of levels equals the number of complete observations. |
clustname |
A string for the name of the cluster defining variable. |
y.names |
A string for the name of the outcome. |
a.names |
A string for the name of the exposure. |
x.names |
A string vector for the variable names in |
ax.names |
A string vector for the variable names in |
v.names |
A string vector for the variable names in |
z.names |
A string vector for the variable names in |
yx.names |
A string vector for the variable names in |
olink |
A character string naming the link function in the outcome nuisance model. |
elink |
A character string naming the link function in the outcome nuisance model. |
cond |
A logical value indicating whether cluster-specific intercepts should
be assumed. If |
oterms |
The |
eterms |
The |
Author(s)
Johan Zetterqvist, Arvid Sjölander
See Also
drgee
, gee
, model.frame
and model.matrix
.