Skip to content
Prev 6444 / 63424 Next

lme: how to extract the variance components?

"Jean Wu" <darmy16@hotmail.com> writes:
It's been a while, but I have some old code saying


lme.obj <- lme(log(Height)~ns(sqrt(Age),knots=c(0.25,.5,1,5),
  Boundary.knots=c(0,10)), random=~sqrt(Age)|ID,
  correlation=corExp(form=~sqrt(Age),nugget=F))
Age.new <- seq(0,10,0.01)  
C.mat  <- lme.obj$sigma^2*as.matrix(lme.obj$modelStruct$reStruct$ID)
SD <- sqrt(sapply(Age.new,
  function(a){x<-c(1,sqrt(a)); t(x) %*% C.mat %*% x})
  +lme.obj$sigma^2)

so I would expect that you want 

pet3.lme$sigma^2 * as.matrix(pet3.lme$modelStruct$reStruct$No)