Hi,
I am trying to extract means and SEs from an lmer object.
So, I followed the example code from http://glmm.wikidot.com/faq
from the "Predictions and/or confidence (or prediction) intervals on predictions" section of the faq

library(lme4)    
library(ggplot2) # Plotting
library(MEMSS) # for Orthodont
fm1 = lmer(
    formula = distance ~ age*Sex + (age|Subject)
    , data = Orthodont
)
newdat <- expand.grid(
    age=c(8,10,12,14)
    , Sex=c("Male","Female")
    , distance = 0
)
mm = model.matrix(terms(fm1),newdat)
newdat$distance = mm %*% fixef(fm1)
pvar1 <- diag(mm %*% tcrossprod(vcov(fm1),mm))
tvar1 <- pvar1+VarCorr(fm1)$Subject[1]
newdat <- data.frame(
    newdat
    , plo = newdat$distance-2*sqrt(pvar1)
    , phi = newdat$distance+2*sqrt(pvar1)
    , tlo = newdat$distance-2*sqrt(tvar1)
    , thi = newdat$distance+2*sqrt(tvar1)
)
When I get to the "newdat$distance = mm %*% fixef(fm1)" I get the following error:
"Error in UseMethod("fixef") : 
  no applicable method for 'fixef' applied to an object of class "mer""

I am using lme4 version version 0.999375-42 (the most recent version on Cran) with R version 2.14.0

Any explanation for this would be greatly appreciated.

Chris Eckert
Department of Biology
Queen's University
Kingston, Ontario, Canada

	[[alternative HTML version deleted]]


