[R] Convert nlme formula to nlmer

Ben Bolker bbolker at gmail.com
Fri Jun 20 21:12:39 CEST 2014

Roxane Foulser-Piggott <rf371 <at> cam.ac.uk> writes:

>  R version 3.1.0 (2014-04-10) -- "Spring Dance”. Platform:
> x86_64-apple-darwin13.1.0 (64-bit).  

> I would like to convert the following function from nlme to nlmer.
> I am finding it difficult to apply the documentation I can find on
> this procedure to this problem.  The function predicts earthquake
> ground-shaking (lnIa) as a function of M, Rrup, Ztor, Fevent, Vs30
> and e1.  I am converting to nlmer, as once I have it running, I will
> explore crossed and nested mixed effects.
> eq1 <- nlme( lnIa ~ c0 + m1*(M-5) + 
  (r1a + r1b*M)*log(sqrt(Rrup^2 + Ztor^2)) + f1*Fevent + v1*log(Vs30/760)  
  + e1,fixed=c0+m1+r1a+r1b+f1+v1~1,random=e1~1|Event,data = data, 
  start = c(c0=11,m1=-0.9,r1a=0.5,r1b=-0.52,f1=0.9,v1=-1.32))
You will probably have more luck with this question on the
r-sig-mixed-models at r-project.org mailing list.

Unfortunately one of the things you will also find is that although
the basic computational machinery is in place, nlmer is much less
well developed than nlme.  See http://rpubs.com/bbolker/3423 for
an extended example of a nonlinear model that incorporates 
non-trivial fixed effects ...

More information about the R-help mailing list