Skip to content

nlme vs nlmer

2 messages · Christof Kluß, Ben Bolker

#
Hi

can you give me a hint how to convert a nlme(..) like

nlme(Y ~ fun(X,a,b,c),
     fixed  = list(a ~ 1, b ~ 1, c ~ 1),
     random = list(a ~ 1, b ~ 1, c ~ 1),
     groups = ~ location,
     data   = measurements,
     start  = c(a = 350, b = 0.2, c = 120))

to an equivalent nlmer(...)? The following seems to be wrong

nlmer(Y ~ fun(X,a,b,c) ~ (a  + b + c | location),
              data = measurements,
              start = c(a = 350, b = 0.2, c = 120))

it throws "gradient attribute of evaluated model must be a numeric matrix"

thx
Christof
2 days later
#
Christof Klu? <ckluss at ...> writes:
I believe you need to define your own gradient function explicitly
(but you may  be able do it with the deriv() function) -- searching the archives
for examples gives e.g.

https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q4/006967.html
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q1/005727.html