I am trying to use the GEE package in R to fit a GEE model to some clinical trial data. The model fits fine using independent, or exchangeable correlation structures. I'm trying to use an AR-1 structure as follows:

eff.gee.ar <- gee(cluster_severity ~ logtime + cluster + cluster*logtime,
           corstr = "AR-M", Mv = 1,
           id = ID,  data=ral2)

but this is causing the following error message:

Error in gee(cluster_severity ~ logtime + cluster + cluster * logtime,  : 
   VC_GEE_covlag: arg has > MAX_COVLAG rows

The data are sensitive so I cannot share them, but here is the head() view, to give you an idea of how they are arranged. They are sorted so that the cluster (ID) is always contiguous (as instructed in the GEE package). There are ~70k rows to the ral2 data frame.

> head(ral2, n=20)
   ID WEEK  cluster cluster_severity  logtime
1   1    0 cluster1        2.0000000 0.000000
2   1    0 cluster2        0.7500000 0.000000
3   1    0 cluster3        1.5000000 0.000000
4   1    0 cluster4        2.3333333 0.000000
5   1    2 cluster1        1.4000000 1.098612
6   1    2 cluster2        0.0000000 1.098612
7   1    2 cluster3        1.0000000 1.098612
8   1    2 cluster4        2.3333333 1.098612
9   1    4 cluster1        0.2000000 1.609438
10  1    4 cluster2        0.0000000 1.609438
11  1    4 cluster3        0.7500000 1.609438
12  1    4 cluster4        3.0000000 1.609438
13  1    6 cluster1        0.4000000 1.945910
14  1    6 cluster2        0.0000000 1.945910
15  1    6 cluster3        0.5000000 1.945910
16  1    6 cluster4        2.0000000 1.945910
17  2    0 cluster1        1.8000000 0.000000
18  2    0 cluster2        0.2500000 0.000000
19  2    0 cluster3        0.7500000 0.000000
20  2    0 cluster4        0.6666667 0.000000

Any advice or illumination regarding this error message would be greatly appreciated. Google only returns 6 results for the error message :(.

My only intuition so far is that the AR-1 structure cannot be fit to individuals for whom there is only one data point (e.g. subjectID == 2 in the above illustration), although for some reason I expected that a GEE would be fine with this missingness.

On a related note, is it true that GEE's are robust to mis-specification of the correlation structure anyway? This seems to be word on the street, but I haven't found citations for/against this view.

Thanks in advance to any GEE-ers.


2 Answers 2


Apparently GEEs are a lonely topic in crossvalidated these days :(

I think the AR-M structure didn't work because there was high correlation between some of the random effects in the model. I fixed it by trying harder to model the data in a mixed-effects regression framework with an appropriate random effects setup.

I still haven't seen any definitive answer on mis-specification of the correlation structure in GEEs, but in my experience it doesn't seem to affect fixed effects estimates much (usually the same to 3.s.f). Perhaps it is more of an issue in smaller datasets, this one is reasonably large.


Sorry no one answered your question, @Achekroud.

MAX_COVLAG is fixed at 30 in gee's C code. I had a feeling that it was around this level when I restricted my daily data to be within one month, and then I got another error:

  cgee: M-dependence, M=1, but clustsize=1
fatal error for this model

which I think answers the other question you had about whether you could have only one time point for each subject. Apparently that answer is "no."

The commit history on that C file is pretty interesting, with 4 commits spanning 1977 to 2012. This code was written in a different era of computing.

I'm going to use the independence working assumption (just deleting corstr and Mv) which is way more robust. There is also the warning from Pepe and Anderson (1994) where "either a diagonal working covariance matrix should be used or a key assumption should be verified. The assumption is non-trivial when covariates vary over time." Well, our covariates vary over time and I'm not in the mood to verify the "key assumption" (which is pretty theoretical if I remember correctly.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.