Dear List,

I am trying to generate prediction intervals for an nlme model by following the example provided in http://glmm.wikidot.com/faq

I have encountered a problem when  calculating "predvar" and an error message is produced.

The problem, as far as I can tell, is actually in creating the model matrix: "Error in Designmat %*% fm1$varFix : non-conformable arguments"

Here is the code I have used

library(nlme)

##
fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc),
data = Loblolly,
fixed = Asym + R0 + lrc ~ 1,
random = Asym ~ 1,
start = c(Asym = 103, R0 = -8.5, lrc = -3.3))

newLoblolly$pred<-predict(fm1, newLoblolly)
newLoblolly <- expand.grid(age = c(5,10,15,20,25,30), Seed = c(301,327))
newLoblolly$pred<-predict(fm1, newLoblolly, level=0)

Designmat <- model.matrix(eval(eval(fm1$call$model)[-2]), newLoblolly[-3])
Designmat

      (Intercept)
[1,]           1
[2,]           1
[3,]           1
[4,]           1
[5,]           1
[6,]           1
[7,]           1
[8,]           1
[9,]           1
[10,]           1
[11,]           1
[12,]           1
attr(,"assign")
[1] 0

predvar <- diag(Designmat %*% fm1$varFix %*% t(Designmat))

"Error in Designmat %*% fm1$varFix : non-conformable arguments"

I have also tried constructing a model matrix using the restrict function from the nlme library

rs1 <- reStruct(list(Seed = ~age), data = newLoblolly)
model.matrix(rs1, newLoblolly)
newDesignmat<-model.matrix(rs1, newLoblolly)

I receive the exactly the same error message as above once I reach the "predvar" step.

Can anyone help or provide a suggestion?

Thank you in advance.

Andrew

Dr. Andrew Close
School of Biology
Newcastle University





	[[alternative HTML version deleted]]

