[R-sig-ME] nlmer: gradient for random change point model

Ken Beath kjbeath at kagi.com
Wed Dec 12 11:54:48 CET 2007

On 12/12/2007, at 10:26 AM, David Atkins wrote:

> Hi all--
> I am attempting to implement a nonlinear mixed-effects model in  
> nlmer() that I have gotten to work (well, at least run) in nlme().   
> However, nlmer() requires the gradient function, and I've gotten a  
> bit stuck there.
> Here's a bit of background, and some data are attached with script  
> below:
> In psychotherapy research we often see two phases of improvement: an  
> early rapid phase, and a later slower phase.  Thus, a piecewise  
> linear model can be a reasonably good fit, except that the  
> breakpoint is different for different folk.  The following article  
> describes how it is possible to set up a nonlinear mixed-effects  
> model like this with a random effect for the breakpoint:
> Cudeck, R., & Klebe, K. J. (2002). Multiphase mixed-effects models  
> for repeated measures data. Psychological Methods, 7, 41-63.

I expect that all of these (I remember reading it for nlme) require  
that the function have continuous derivatives (probably twice) in the  
parameters, which it wont be with the type of breakpoint you are  
using. So one of their other methods might work. Or see http://www.biostat.wustl.edu/archives/html/s-news/2000-04/msg00209.html 
  for methods for nls that will probably work with nlme as well.

> A biostatistician colleague of mine has used SAS to fit such a model  
> to some weekly psychotherapy data of a mutual colleague.  However,  
> NLMIXED didn't particularly like our data, and he had to search over  
> a wide grid of initial starting values to ever get it to converge.

One worry is that it hasn't converged to the correct values when this  


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