## Create a 'groupedData' object from 'Orthondont' data set:
library(nlme)
orthGD <-
groupedData(distance ~ age | Subject,
data = as.data.frame(Orthodont),
FUN = mean,
outer = ~ Sex,
labels = list(x = "Age",
y = "Distance from pituitary to pterygomaxillary fissure"),
units = list( x = "(yr)", y = "(mm)"))
dim(orthGD)
## Create a 'gdManager' that points to the ff files in tempdir():
orthMgr <- groupedData2ff(gd=orthGD, gcol=3, prefix=tempfile())
## In the ff file 'Sex' is coded as `1` for male and `2` for female.
## We adjust the coding to `0` and `1`.
numdat(orthMgr)[,"Sex"] <- numdat(orthMgr)[,"Sex"] - 1
## Call the GEE solver:
res <- pargee(orthMgr, gaussian, c(0, 0, 0))
## Coefficients and standard errors:
round(res$coefficients, 4)
round(sqrt(diag(res$robust.variance)), 4)
## Compare results with those from geeglm() from the geepack package:
library(geepack)
geeglm <- geeglm(distance ~ age + Sex, data=orthGD, id=Subject)
round(summary(geeglm)$coefficients, 4)
Run the code above in your browser using DataLab