[R-sig-ME] nlme vs nlmer

Ben Bolker bbolker at gmail.com
Mon Oct 1 00:51:50 CEST 2012


Christof Kluß <ckluss at ...> writes:

> 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"

  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



More information about the R-sig-mixed-models mailing list