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

Ken Beath kjbeath at kagi.com
Thu Dec 13 11:29:06 CET 2007


On 13/12/2007, at 3:32 PM, Ken Beath wrote:

>
> The zero derivatives are due to the interval around the breakpoint not
> containing any data, I suggest placing the initial changepoint in the
> centre of the data and then increasing eps until it works.
>
>

This is not correct, reason is that starting values for both slopes  
must be different, otherwise changing the breakpoint location doesn't  
change anything. It also helps to get the starting values close to the  
true values.
Following works fine

test.nls <- nls(dv ~ hockey(weeks, alpha1, beta1, beta2, brk),
						start= list(alpha1=30,beta1=-6,beta2=0,brk=5),
						trace=TRUE,
                        data = small.df)

Ken




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