glmgee: Fit Generalized Estimating Equations

View source: R/geeglm.R

glmgeeR Documentation

Fit Generalized Estimating Equations

Description

Produces an object of the class glmgee in which the main results of a Generalized Estimating Equation (GEE) fitted to the data are stored.

Usage

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

Arguments

formula

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

family

an (optional) family object, that is, a list of functions and expressions for defining link and variance functions. Families (and links) supported are the same supported by glm using its family argument, that is, gaussian, binomial, poisson, Gamma, inverse.gaussian, and quasi. The family negative.binomial in the library MASS are also available. As default, the argument family is set to 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 total number of observations.

id

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

waves

an (optional) positive integer-valued variable that is used to identify the order and spacing of observations within clusters. This argument is crucial when there are missing values and gaps in the data. As 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 for 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

an (optional) character string which allows to specify the working-correlation structure. The available options are: "Independence", "Unstructured", "Stationary-M-dependent(m)", "Non-Stationary-M-dependent(m)", "AR-M-dependent(m)", "Exchangeable" and "User-defined", where m represents the lag of the dependence. As default, corstr is set to "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. As default, scale.fix is set to FALSE.

scale.value

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

toler

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

maxit

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

trace

an (optional) logical variable. If TRUE, output is produced for each iteration of the estimating algorithm.

...

further arguments passed to or from other methods.

Details

The values of the multivariate response variable measured on n subjects or clusters, denoted by y_{i}=(y_{i1},\ldots,y_{in_i})^{\top} for i=1,\ldots,n, are assumed to be realizations of independent random vectors denoted by Y_{i}=(Y_{i1},\ldots,Y_{in_i})^{\top} for i=1,\ldots,n. The random variables associated to the i-th subject or cluster, Y_{ij} for j=1,\ldots,n_i, are assumed to satisfy \mu_{ij}= E(Y_{ij}),Var(Y_{ij})=\frac{\phi}{\omega_{ij}}V(\mu_{ij}) and Corr(Y_{ij},Y_{ik})=r_{jk}(\rho), where \phi>0 is the dispersion parameter, V(\mu_{ij}) is the variance function, \omega_{ij}>0 is a known weight, and \rho=(\rho_1,\ldots,\rho_q)^{\top} is a parameter vector. In addition, \mu_{ij} is assumed to be dependent on the regressors vector x_{ij} by g(\mu_{ij})=z_{ij} + x_{ij}^{\top}\beta, where g(\cdot) is the link function, z_{ij} is a known offset and \beta=(\beta_1,\ldots,\beta_p)^{\top} is a vector of regression parameters. The parameter estimates are obtained by iteratively solving the estimating equations described by Liang and Zeger (1986).

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

A set of standard extractor functions for fitted model objects is available for objects of class glmgee, including methods to generic functions such as print, summary, model.matrix, estequa, coef, vcov, logLik, fitted, confint and predict. In addition, the model may be assessed using functions such as anova.glmgee, residuals.glmgee, dfbeta.glmgee, cooks.distance.glmgee, localInfluence.glmgee, tidy.glmgee and glance.glmgee. The variable selection may be accomplished using the routine stepCriterion.glmgee.

Value

an object of class glmgee in which the main results of the GEE model fitted to the data are stored, i.e., a list with components including

coefficients a vector with the estimates of \beta_1,\ldots,\beta_p,
fitted.values a vector with the estimates of \mu_{ij} for i=1,\ldots,n and j=1,\ldots,n_i,
start a vector with the starting values used,
iter a numeric constant with the number of iterations,
prior.weights a vector with the values of \omega_{ij} for i=1,\ldots,n and j=1,\ldots,n_i,
offset a vector with the values of z_{ij} for i=1,\ldots,n and j=1,\ldots,n_i,
terms an object containing the terms objects,
loglik the value of the quasi-log-likelihood function evaluated at the parameter
estimates and the observed data,
estfun a vector with the estimating equations evaluated at the parameter
estimates and the observed data,
formula the formula,
levels the levels of the categorical regressors,
contrasts an object containing the contrasts corresponding to levels,
converged a logical indicating successful convergence,
model the full model frame,
y a vector with the values of y_{ij} for i=1,\ldots,n and j=1,\ldots,n_i,
family an object containing the family object used,
linear.predictors a vector with the estimates of g(\mu_{ij}) for i=1,\ldots,n and j=1,\ldots,n_i,
R a matrix with the (robust) estimate of the variance-covariance,
corr a matrix with the estimate of the working-correlation,
corstr a character string specifying the working-correlation structure,
id a vector which identifies the subjects or clusters,
sizes a vector with the values of n_i for i=1,\ldots,n,
call the original function call,

References

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

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

Vanegas L.H., Rondon L.M., Paula G.A. (2023) Generalized Estimating Equations using the new R package glmtoolbox. The R Journal 15:105-133.

See Also

gnmgee, wglmgee

Examples

###### Example 1: Effect of ozone-enriched atmosphere on growth of sitka spruces
data(spruces)
mod1 <- size ~ poly(days,4) + treat
fit1 <- glmgee(mod1, id=tree, family=Gamma(log), corstr="AR-M-dependent(1)", data=spruces)
summary(fit1, corr.digits=2)

###### Example 2: Treatment for severe postnatal depression
data(depression)
mod2 <- depressd ~ visit + group
fit2 <- glmgee(mod2, id=subj, family=binomial(logit), corstr="AR-M-dependent(1)", data=depression)
summary(fit2, corr.digits=2)

###### Example 3: Treatment for severe postnatal depression (2)
data(depression)
mod3 <- dep ~ visit*group
fit3 <- glmgee(mod3, id=subj, family=gaussian, corstr="AR-M-dependent(1)", data=depression)
summary(fit3, corr.digits=2)

###### Example 4: Dental Clinical Trial
data(rinse)
mod4 <- score/3.6 ~ rinse*time
fit4 <- glmgee(mod4, family=binomial(log), id=subject, corstr="Exchangeable", data=rinse)
summary(fit4, corr.digits=2)

###### Example 5: Shoulder Pain after Laparoscopic Cholecystectomy
data(cholecystectomy)
mod5 <- pain2 ~ treatment + age + time
corstr <- "Stationary-M-dependent(2)"
fit5 <- glmgee(mod5, family=binomial(logit), id=id, corstr=corstr, data=cholecystectomy)
summary(fit5,varest="bias-corrected")

###### Example 6: Guidelines for Urinary Incontinence Discussion and Evaluation
data(GUIDE)
mod6 <- bothered ~ gender + age + dayacc + severe + toilet
fit6 <- glmgee(mod6, family=binomial(logit), id=practice, corstr="Exchangeable", data=GUIDE)
summary(fit6)

###### Example 7: Tests of Auditory Perception in Children with OME
OME <- MASS::OME
mod7 <- cbind(Correct, Trials-Correct) ~ Loud + Age + OME
fit7 <- glmgee(mod7, family = binomial(cloglog), id = ID, corstr = "Exchangeable", data = OME)
summary(fit7, corr=FALSE)

###### Example 8: Epileptic seizures
data(Seizures)
Seizures2 <- within(Seizures, time4 <- ifelse(time==4,1,0))
mod8 <- seizures ~ log(age) + time4 + log(base/4)*treatment
fit8 <- glmgee(mod8, family=poisson(log), id=id, corstr="Exchangeable", data=Seizures2)
summary(fit8)


glmtoolbox documentation built on Sept. 11, 2024, 7:32 p.m.