Learn R Programming

drgee (version 1.1.2)

drgeeData: 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, estimation.method = c("dr", "o", "e"),
          cond = FALSE, clusterid)

Arguments

outcome
The outcome as a variable or as a character string naming a variable in the data argument. If it is not found in the data argument, it will be searched for in the calling frame. If missing, the outcome is assumed to b
exposure
The exposure as a variable or as a character string naming a variable in the data argument. If it is not found in the data argument, it will be searched for in the calling frame. If missing, the outcome is assumed to
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 a
olink
A character string naming the link function in the outcome nuisance model. Have to be "identity", "log" or "logit". Default is "identity".
elink
A character string naming the link function in the exposure nuisance model. Have to be "identity", "log" or "logit". Default is "identity". When olink="logit" this is replaced by
data
A data frame or environment containing the variables in iaformula, oformula and eformula. If missing, variables are expected to be found in the calling frame.
estimation.method
A character string naming the desired estimation method. Choose "o" for O-estimation, "e" for E-estimation or "dr" for DR-estimation. Default is "dr".
cond
A logical value indicating whether the nuisance models should have cluster-specific intercepts. If cond=TRUE the design matrices for the nuisance models do not have an intercept. Requires a clusterid argument.
clusterid
A cluster-defining variable or a character string naming a cluster-defining variable in the data argument. If it is not found in the data argument, it will be searched for in the calling frame. If missing, each observ

Value

  • drgee.data returns an object of class drgeeData containing
  • yThe outcome matrix.
  • outnameA string for the name of the outcome.
  • aThe exposure matrix.
  • expnameA string for the name of the exposure.
  • xThe matrix of of interactions defined in iaformula. This matrix will always contain a column with 1's.
  • axThe matrix of elementwise product(s) of a and each column in x.
  • vThe matrix of terms in the outcome nuisance model.
  • zThe matrix of terms in the exposure nuisance model.
  • yxThe matrix of elementwise product(s) of y and each column in x.
  • idA factor defining clusters. For independent observations, the number of levels equals the number of complete observations.
  • clustnameA string for the name of the cluster defining variable.
  • olinkA character string naming the link function in the outcome nuisance model.
  • elinkA character string naming the link function in the outcome nuisance model.
  • condA logical value indicating whether cluster-specific intercepts should be assumed. If TRUE, the is no column for the intercept in v and z. Outcome concordant will also be removed.
  • otermsThe terms object corresponding to the outcome nuisance model.
  • etermsThe terms object corresponding to the exposure nuisance model.
  • All matrix elements have rows corresponding to the complete observations in the original data.

encoding

latin1

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.

See Also

drgee, gee, model.frame and model.matrix.