Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

glmgee

Generalized Estimating Equations


Description

Produces an object of the class glmgee in which are stored the main results of the generalized estimating equation fitted to the data.

Usage

glmgee(
  formula,
  family = gaussian(),
  weights,
  id,
  waves,
  data,
  subset,
  corstr,
  corr,
  start,
  scale.fix = FALSE,
  scale.value,
  toler = 1e-07,
  maxit = 50,
  adjr2 = FALSE,
  ...
)

Arguments

formula

a formula expression of the form response ~ predictors, which is a symbolic description of the linear predictor of the model to be fitted to the data.

family

a family object, that is, a list of functions and expressions for defining link and variance functions. Families supported are gaussian, binomial, poisson, Gamma, inverse gaussian and quasi. See the glm and family documentation. By default, family is set to be gaussian("identity").

weights

an (optional) vector of positive "prior weights" to be used in the fitting process. The length of weights should be the same as the number of observations.

id

a vector which identifies the clusters. The length of id should be the same as the number of observations.

waves

an (optional) a positive integer-valued variable that is used to identify the order and spacing of observations within groups. This argument is crucial when there are missing values and gaps in the data. By default, waves is equal to the integers from 1 to the size of each cluster.

data

an (optional) data frame in which to look for variables involved in the formula expression, as well as the variables specified in the arguments id and weights. The data are assumed to be sorted by id and time.

subset

an (optional) vector specifying a subset of observations to be used in the fitting process.

corstr

a character string specifying the (working) correlation structure. The available options are: "Independence", "Unstructured", "Stationary-M-dependent(m)", "Non-Stationary-M-dependent(m)", "AR-1", "Exchangeable" and "User-defined", where m represents the lag of the dependence. By default, corstr is set to be "Independence".

corr

an (optional) square matrix of the same dimension of the maximum cluster size containing the user specified correlation. This is only appropriate if corstr is specified to be "User-defined".

start

an (optional) vector of starting values for the parameters in the linear predictor.

scale.fix

an (optional) logical variable. If TRUE, the scale parameter is fixed at the value of scale.value. By default, scale.fix is set to be FALSE.

scale.value

an (optional) numeric variable giving the value to which the scale parameter should be fixed. This is only appropriate if scale.fix=TRUE. By default, scale.value is set to be 1.

toler

an (optional) positive value which represents the convergence tolerance. The convergence is reached when the maximum of the relative differences between the values of the parameters in the linear predictor in consecutive iterations of the fitting algorithm is lower than toler. By default, toler is set to be 0.0000001.

maxit

an (optional) integer value which represents the maximum number of iterations allowed for the fitting algorithm. By default, maxit is set to be 50.

adjr2

an (optional) logical variable. If TRUE, the adjusted deviance-based R-squared is calculated. By default, adjr2 is set to be FALSE.

...

further arguments passed to or from other methods.

Details

If the value of waves for a cluster of size 4 is 2, 4, 5, 6 then it means that the data on times 1 and 3 are missing, which should be taken into account by glmgee to estimate the correlation matrix when its structure is assumed to be "Unstructured", "Stationary-M-dependent", "Non-Stationary-M-dependent" or "AR-1". If in this scenario waves is not specified then glmgee assumes that the available data for this cluster were taken on point times 1, 2, 3 and 4.

Value

an object of the class glmgee in which are stored the main results of the generalized estimating equation fitted to the data. Some of those results can be easily accessed using functions as, for example, print(), summary(), model.matrix(), estequa(), coef(), vcov(), logLik(), fitted(), confint() and predict(). In addition, the model fitted to the data can be assessed using functions as, for instance, anova.glmgee, residuals.glmgee, dfbeta.glmgee and cooks.distance.glmgee. The variable selection may be accomplished using stepCriterion.glmgee whereas the working–correlation–structure can be chosen by using criteria as QIC, CIC, DEW and RJC.

References

Liang K.Y. and Zeger S.L. (1986) Longitudinal data analysis using generalized linear models. Biometrika 73, 13-22.

Zeger S.L. and Liang K.Y. (1986) Longitudinal data analysis for discrete and continuous outcomes. Biometrics 42, 121-130.

Hardin J.W. and Hilbe J.M. (2013). Generalized Estimating Equations. Chapman & Hall, London.

Examples

## Example 1
mod1 <- size ~ poly(days,4) + treat
fit1 <- glmgee(mod1, id=tree, family=Gamma("log"), corstr="AR-1", data=spruce)
summary(fit1)

## Example 2
mod2 <- depressd ~ visit + group
fit2 <- glmgee(mod2, id=subj, family=binomial("logit"), corstr="Exchangeable", data=depression)
summary(fit2)

## Example 3
mod3 <- dep ~ visit + group
fit3 <- glmgee(mod3, id=subj, corstr="Non-Stationary-M-dependent(2)", data=depression)
summary(fit3)

glmtoolbox

Set of Tools to Data Analysis using Generalized Linear Models

v0.1.0
GPL-2 | GPL-3
Authors
Luis Hernando Vanegas [aut, cre], Luz Marina Rondón [aut], Gilberto A. Paula [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.