I am trying to do forward model selection between marginal models fit with GEE, using Quasi-Akaike Criterion (QIC) as the selection criterion. However, when I use the dredge function from the MuMIn package, my global model is rank-deficient.
On this question a similar problem was resolved by "tricking" MuMIn. This was done by fitting a smaller global model that worked, updating the formula argument of that model, and using that. However, I can't get this to work while using the wgee() function from the wgeesel package.
Here is a reproducible example from R using the IMPS longitudinal dataset.
####Example1
data(imps)
library(wgeesel)
imps.complete <- na.omit(imps)
imps.complete$repd<-imps.complete$Drug #repeat a column to make model rank-deficient
fit <- wgee(IMPS79 ~ Drug+Sex+Time+repd, data=imps.complete,
id=imps.complete$ID, family="gaussian",
corstr="exchangeable", scale=NULL)
gee.min <- wgee(IMPS79 ~ Drug+Sex+Time, data=imps.complete,
id=imps.complete$ID, family="gaussian",
corstr="exchangeable", scale=NULL) #this model can be fit
gee.min$model #IMPS79 ~ Drug + Sex + Time
gee.min$model <- IMPS79 ~ Drug + Sex + Time + repd #update model argument
#try the solution from other stackoverflow page. doesn't work
options(na.action=na.fail)
gee.retry <- model.sel(lapply(
dredge(gee.min,fixed=c("Drug","Sex"),rank="QIC",evaluate=FALSE),
eval),rank="QIC")
# note that the call argument cannot be updated
gee.min$call <- wgee(model = IMPS79 ~ Drug + Sex + Time + repd, data = imps.complete,
id = imps.complete$ID, family = "gaussian", corstr = "exchangeable",
scale = NULL)
The error code I get is "Error in QIC(global.model) : Model matrix is rank deficient; geeglm can not proceed". I am guessing dredge is trying to evaluate QIC on the global model, which it can't do
Any help would be appreciated! I am doing a similar procedure on many different models, and want my methodology to be reproducible, so I am looking for some sort of automated way to do forward model selection using QIC.