I have simulated some longitudinal data with 100 subjects and 7 measurements per subject. My data has random intercept which will induce "exchangeable" correlation matrix. My goal is to fit two separate models below and compare the results:
- Model 1: GLM (not accounting for within-subj correlation)
- Model 2: GEE with exchangeable correlation structure
We know that GLM is basically GEE with "Independent" correlation structure. What happens is my GEE only takes ONE iteration and therefore returns the estimates from it's first iteration (initial estimates) which are GLM estimates (Code is in R).
I've tried different simulation scenarios where the estimated exchangeable correlation matrix has: Low, medium, and high off-diagonal correlation values but in all of them my GLM estimates and GEE estimates are all the same (that is over 2000 different simulated data and 100% of estimates are the same between GEE and GLM). Why do you think this happens?
Here is my code:
# Data Simulation:
dataSim <- function(seedNum, n, mi, beta0FE, beta1, beta0RE){
# Setting the seed number:
set.seed(seedNum)
# Generating covariates:
x <- rnorm(n, mean = 0, sd = 1)
# Generating Y:
data <- data.frame(id = rep(1:n, each = mi), x = rep(x, each = mi),
beta0_RE = rep(beta0RE, each = mi))
etaTmp <- data$beta0_RE + beta0FE + beta1*data$x
piTmp <- exp(etaTmp)/(1 + exp(etaTmp))
data$Y <- sapply(piTmp, rbinom, n = 1, size = 1)
return(data)
}
# Data Simulation Parameters:
n <- 300
mi <- 7
beta0FE <- 0.3
beta1 <- 1
beta0RE <- rnorm(n, mean = 0, sd = 1)
data <- dataSim(1, n, mi, beta0FE, beta1, beta0RE)
fit.glm <- glm(Y ~ x, data = data, family='binomial')
fit.gee <- gee(Y ~ x, id = id, data = data, family = binomial,
corstr = "exchangeable", silent = TRUE)