## See vignette for the sampling scheme.
set.seed(12345)
N <- 500
clsize <- 4
intercepts <- c(-1.5, -0.5, 0.5, 1.5)
cor.matrix <- toeplitz(c(1, 0.85, 0.5, 0.15))
lin.pred <- rsmvnorm(N, toeplitz(c(1, rep(0.85, clsize-1))))
Y <- rmult.clm(clsize, lin.pred, cor.matrix, intercepts, "probit")$Ysim
data <- cbind(c(t(Y)), c(t(lin.pred)))
data <- data.frame(data)
data$id <- rep(1:N, each=clsize)
data$time <- rep(1:clsize, N)
colnames(data) <- c("y", "x", "id", "time")
## Fit a GEE model (Touloumis et al., 2013) to estimate the regression coefficients.
library(multgee)
fitmod <- ordLORgee(y~x, data=data, id=id, repeated=time, link="probit", IM="cholesky")
coef(fitmod)
Run the code above in your browser using DataLab