Learn R Programming

geepack (version 1.3.12)

geeglm: Fit Generalized Estimating Equations (GEE)

Description

The geeglm function fits generalized estimating equations using the 'geese.fit' function of the 'geepack' package for doing the actual computations. geeglm has a syntax similar to glm and returns an object similar to a glm object. An important feature of geeglm, is that an anova method exists for these models.

Usage

geeglm(
  formula,
  family = gaussian,
  data = parent.frame(),
  weights,
  subset,
  na.action,
  start = NULL,
  etastart,
  mustart,
  offset,
  control = geese.control(...),
  method = "glm.fit",
  contrasts = NULL,
  id,
  waves = NULL,
  zcor = NULL,
  corstr = "independence",
  scale.fix = FALSE,
  scale.value = 1,
  std.err = "san.se",
  ...
)

Value

An object of type 'geeglm'

Arguments

formula

See corresponding documentation to glm

family

See corresponding documentation to glm

data

See corresponding documentation to glm

weights

See corresponding documentation to glm

subset

See corresponding documentation to glm

na.action

No action is taken. Indeed geeglm only works on complete data.

start

See corresponding documentation to glm

etastart

See corresponding documentation to glm

mustart

See corresponding documentation to glm

offset

See corresponding documentation to glm

control

See corresponding documentation to glm

method

See corresponding documentation to glm

contrasts

See corresponding documentation to glm

id

a vector which identifies the clusters. The length of `id' should be the same as the number of observations. Data are assumed to be sorted so that observations on each cluster appear as contiguous rows in data. If data is not sorted this way, the function will not identify the clusters correctly. If data is not sorted this way, a warning will be issued. Please consult the package vignette for details.

waves

Wariable specifying the ordering of repeated mesurements on the same unit. Also used in connection with missing values. Please consult the package vignette for details.

zcor

Used for entering a user defined working correlation structure.

corstr

a character string specifying the correlation structure. The following are permitted: '"independence"', '"exchangeable"', '"ar1"', '"unstructured"' and '"userdefined"'

scale.fix

a logical variable; if true, the scale parameter is fixed at the value of 'scale.value'.

scale.value

numeric variable giving the value to which the scale parameter should be fixed; used only if 'scale.fix = TRUE'.

std.err

Type of standard error to be calculated. Defualt 'san.se' is the usual robust estimate. Other options are 'jack': if approximate jackknife variance estimate should be computed. 'j1s': if 1-step jackknife variance estimate should be computed. 'fij': logical indicating if fully iterated jackknife variance estimate should be computed.

...

further arguments passed to or from other methods.

Warning

Use "unstructured" correlation structure only with great care. (It may cause R to crash).

Author

Søren Højsgaard, sorenh@math.aau.dk

Details

In the case of corstr="fixed" one must provide the zcor vector if the clusters have unequal sizes. Clusters with size one must not be represented in zcor.

References

Halekoh, U.; Højsgaard, S. and Yan, J (2006) The R Package geepack for Generalized Estimating Equations. Journal of Statistical Software, 15, 2, 1-11"

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

Prentice, R.L. and Zhao, L.P. (1991). Estimating equations for parameters in means and covariances of multivariate discrete and continuous responses. Biometrics, 47 825-839.

See Also

geese, glm, anova.geeglm

Examples

Run this code

data(dietox)
dietox$Cu     <- as.factor(dietox$Cu)
mf <- formula(Weight ~ Cu * (Time + I(Time^2) + I(Time^3)))
gee1 <- geeglm(mf, data=dietox, id=Pig, family=poisson("identity"), corstr="ar1")
gee1
coef(gee1)
vcov(gee1)
summary(gee1)
coef(summary(gee1))

mf2 <- formula(Weight ~ Cu * Time + I(Time^2) + I(Time^3))
gee2 <- geeglm(mf2, data=dietox, id=Pig, family=poisson("identity"), corstr="ar1")
anova(gee2)

# Notice the difference here: Clusters of observations must
# appear as chunks in data. 

set.seed(1)
chick1 <- ChickWeight
chick2 <- chick1[sample(nrow(chick1)),]
chick3 <- chick2[order(chick2$Chick),]

fit1 <- geeglm(weight~Time, id=Chick, data=chick1)
fit2 <- geeglm(weight~Time, id=Chick, data=chick2)
fit3 <- geeglm(weight~Time, id=Chick, data=chick3)

vcov(fit1)
vcov(fit2)
vcov(fit3)



Run the code above in your browser using DataLab