I am wondering if anyone knows how to use predict with a glmmPQL model,
where you want to predict the response for one factor in the model?

Originally I used predict on a GLM (gamma, log link) in the following
way:

p.1<-predict(model1,data.frame(year=as.factor(xv),nafdiv=as.factor(rep("
3N",length(xv))), duration=1000, cfv=as.factor(rep(106166,length(xv))),
hooks=rep(1,length(xv))),type="response",se.fit=T)

where model1 standardises catch rate and includes nafo area, year,
duration of fishing sets, and vessel (cfv) as explanatory variables with
an offset of hooks. 
To predict the years we had data for, we substituted a vector "xv" of
years into predict and specified the values to be used for the other
explanatory variables. This seemed to work well.

When I switched to a glmmPQL model, with vessel as a random effect, I
adapted predict to:

predict(model1, catch, type="response")

where catch is the dataframe used for the original model.

 This works but gives a predicted value for every trip (each row) in my
table. I have tried specifying values in a dataframe like 
 the GLM example above and including year as a vector but I get the
following error message 
      "Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : 
      contrasts can be applied only to factors with 2 or more levels" 


Any advice is appreciated!
Sophie

	[[alternative HTML version deleted]]


