Skip to content
Prev 7771 / 20628 Next

extracting gradient and hessian matrix from lme4

Joshua Wiley <jwiley.psych at ...> writes:
If you're willing to try out the development version (i.e., lme4
from r-forge), I think you can do this as follows:

fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
fm1Fun <- update(fm1,devFunOnly=TRUE)
library(numDeriv)
fm1_thpar <- getME(fm1,"theta")
h <- hessian(fm1Fun,fm1_thpar)

  and similarly for the gradient.

  Let me know how it goes.

  Ben Bolker