I've fitted the following model

model1<-glmmTMB(total~treatm+(1|factor1)+(1|factor2)+(1|factor3), data=mydata1, family=nbinom1)

and I performed a post-hoc test like follows:


and it worked fine but, for the following model:

model2<-glmmTMB(total~treatm+(1|factor1)+(1|factor2)+(1|factor3), data=mydata2, family=nbinom1)

when I tried to perform the same post hoc test model2multcomp<-lsmeans(model2,pairwise~treatm), I'm getting the error message below:

Error in ref.grid(object = list(obj = list(par = c(beta = 0, beta = 0,  : 

Can't handle an object of class “glmmTMB” Use help("models", package = "lsmeans") for information on supported models.

I'm surprised that this worked a first time and not at a second time, so that I come ask for your help. Thanks in advance for your help

Notes: treatm is a grouping factor with 7 levels; factor1 is a grouping factor with 11 levels; factor2 is a grouping factor with 6 levels; factor3 is a grouping factor with 8 levels


1 Answer 1


The fact that the error message refers to ref.grid instead of ref_grid indicates that you have an ancient version of lsmeans installed. You should install an updated version, then it has a better chance of working.


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