wglmgee {glmtoolbox}R Documentation

Fit Weighted Generalized Estimating Equations

Description

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

Usage

wglmgee(
  formula,
  level = c("observations", "clusters"),
  family = gaussian(),
  weights,
  id,
  data,
  subset,
  corstr,
  corr,
  start = NULL,
  scale.fix = FALSE,
  scale.value = 1,
  toler = 1e-05,
  maxit = 50,
  trace = FALSE,
  ...
)

Arguments

formula

an Formula expression of the form response ~ x1 + x2 + ... | z1 + z2 + ..., whose first part is a symbolic description of the linear predictor of the GEE model to be fitted to the data, whereas the second part is a symbolic description of the linear predictor of the logistic model to be used to calculate the missingness probabilities under the MAR assumption. Then, those probabilities are used to computed the weights to be included in the parameter estimation algorithm.

level

an (optional) character string which allows to specify the weighted GEE method. The available options are: "observations" and "clusters" for Observation- and Cluster-specified Weighted GEE, respectively. As default, level is set to "observations".

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.

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 probabilities Pr[T_{ij}=1|T_{i,j-1}=1,x_{i1},\ldots,x_{ij},Y_{i1},\ldots,Y_{i,j-1}] are estimated by using a logistic model whose covariates are given by z_{1},\ldots,z_{r}. Then, those probabilities are used to computed the weights to be included in the parameter estimation algorithm.

A set of standard extractor functions for fitted model objects is available for objects of class glmgee, including methods to the generic functions such as print, summary, model.matrix, estequa, coef, vcov, fitted, confint and predict. The input data are assumed to be ordered in time within each cluster.

Value

an object of class wglmgee in which the main results of the weighted 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,
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,
level a character string specifying the weighted GEE method,
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

Fitzmaurice G.M., Laird N.M., Ware J.H. (2011). Applied Longitudinal Analysis. 2nd ed. John Wiley & Sons.

Preisser J.S., Lohman K.K., Rathouz P.J. (2002). Performance of Weighted Estimating Equations for Longitudinal Binary Data with Drop-Outs Missing at Random. Statistics in Medicine 21:3035–3054.

Robins J.M., Rotnitzky A., Zhao L.P. (1995) Analysis of Semiparametric Regression Models for Repeated Outcomes in the Presence of Missing Data. Journal of the American Statistical Association 90:122–129.

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

glmgee, gnmgee

Examples

###### Example: Amenorrhea rates over time
data(amenorrhea)
amenorrhea2 <- within(amenorrhea,{
							 Ctime <- factor(Time)
							 Ctime <- relevel(Ctime,ref="1")
							 ylag1 <- c(0,amenorrhea[-length(ID)])
							 ylag1 <- ifelse(Time==0,0,ylag1)})

mod <- amenorrhea ~ poly(Time,2) + Dose | Ctime + Dose + ylag1

### Observation-specified Weighted GEE
fit1 <- wglmgee(mod, family=binomial, data=amenorrhea2, id=ID,
                corstr="AR-M-dependent(1)", level="observations")
summary(fit1)

### Cluster-specified Weighted GEE
fit2 <- wglmgee(mod, family=binomial, data=amenorrhea2, id=ID,
                corstr="Exchangeable", level="clusters")
summary(fit2)


[Package glmtoolbox version 0.1.12 Index]