Can we use the "predict" function for a gee model? Can we use the "predict" function for a gee model? I know from the gee model we can use "fitted.values" to get the predicted values for the data used to build the model. However, I want to use the gee regression results to generate predicted values for a test data.
data(warpbreaks)

smp_size <- floor(0.75 * nrow(warpbreaks))
set.seed(123)
train_ind <- sample(seq_len(nrow(warpbreaks)), size = smp_size)
train <- warpbreaks[train_ind, ]
test <- warpbreaks[-train_ind, ]

gee_model = gee(breaks ~ tension, id=wool, data=train, 
corstr="exchangeable")

predict(gee_model, train)
predict(gee_model, test)

The last two lines result in the following error.
"Error in seq_len(p) : argument must be coercible to non-negative integer"

Thank you in advance!
 A: I don't think you can use the predict function for a gee model in R. However, as suggested previously (How can I estimate model predicted means (a.k.a. marginal means, lsmeans, or EM means) from a GEE model fitted in R?), you can use the LSmeans function in the doBy package to get predictions for new data. Please note that this creates predicted population means, for better predictions for individuals it may be better to use a random effects model. 
library(gee)
library(doBy)

data(warpbreaks)
smp_size <- floor(0.75 * nrow(warpbreaks))
set.seed(123)
train_ind <- sample(seq_len(nrow(warpbreaks)), size = smp_size)
train <- warpbreaks[train_ind, ]
test <- warpbreaks[-train_ind, ]

gee_model = gee(breaks ~ tension, id=wool, data=train, 
corstr="exchangeable")

pop.mean <- LSmeans(gee_model,effect="tension")

predictions.test <- ifelse(test$tension=="L", pop.mean[[1]][1],
                  ifelse(test$tension=="M", pop.mean[[1]][2],
                         ifelse(test$tension=="H", pop.mean[[1]][3],NA))
                  )

