[R] predict.lme / glmmPQL: "non-conformable arguments"

David Reitter david.reitter at gmail.com
Tue Jan 31 21:39:15 CET 2006


  On 30 Jan 2006, at 22:01, David Reitter wrote:

> I'm trying to use "predict" with a linear mixed-effects logistic  
> regression model fitted with nlmmPQL from the MASS library.
> Unfortunately, I'm getting an error "non-conformable arguments" in  
> predict.lme, and I would like to understand why.

I'd like to add a bit of information. (Correction: I am talking about  
glmmPQL from the MASS library.)

Again, the error I'm getting is:

> > yp = predict(model,  newdata=new, type="response",  level=0)
> Error in X %*% fixef(object) : non-conformable arguments

I have ensured that I input a data frame in newdata with the fixed  
factors/predictors filled in (as factors with the correct level sets  
where appropriate).

Debugging this, I had a look at lme.R from the nlme library.
Specifically, line 1909:

if (maxQ == 0) {
     ## only population predictions
     val <- c(X %*% fixef(object))
     attr(val, "label") <- "Predicted values"
     return(val)
   }

the 'fixef' structure in my model looks like this (7 elements)

fixef(model)
                       (Intercept)                     log(distance)
                       -2.14560407                       -0.13207341
                             roler                     sourcemaptask
                       -0.58692474                       -0.93108113
               log(distance):roler log(distance):rolei:sourcemaptask
                        0.16449238                        0.06877369
log(distance):roler:sourcemaptask
                       -0.12278367


But the predict.lme function produces the following 6x5 matrix

   (Intercept) log(distance) roler sourcemaptask log 
(distance):roler    log(distance):roler:sourcemaptask
           1     0.0000000     1             0           0.0000000  0
          1     0.6931472     1             0           0.6931472  0
(...)

We're missing the coefficient for the 3-way interaction "log 
(distance):rolei:sourcemaptask", which is why we can't come up with  
the inner product of X and the fixed effects coefficients.

Is this an issue with predict.lme, and/or can I do something about it?

Thanks
D




More information about the R-help mailing list