[R] Problem with constrained nlsList model

Rob Forsyth rob.forsyth at newcastle.ac.uk
Tue May 14 11:55:57 CEST 2013


I have some longitudinal data I'm fitting with an asymptotic growth function constrained to the origin. Visual inspection of the dataset suggests this is reasonable!

> library(nlme)
> results <- groupedData(y~Days | ID, data=results)
> m1 <- nlsList(SSasympOrig, na.omit(results))
> m1

Call:
 Model: y ~ SSasympOrig(Days, Asym, lrc) | ID 
  Data: na.omit(results) 

Coefficients:
          Asym       lrc
176    5.259815 -5.048464
186   13.833871 -4.337267
300   16.007862 -4.783315
159   21.509863 -4.241172
144  103.505322 -7.040130
161   49.746946 -5.682995
170   50.964702 -5.739456
293   63.060652 -5.928408
142   49.851672 -4.707905
261   48.612882 -4.568154
184   63.633909 -5.361407
162   49.478622 -4.088146
202  714.579639 -9.128026
303   53.688201 -3.750039
275   63.298936 -4.757936
264   60.868979 -5.029757
199   64.776418 -5.163388
1368 107.784023 -6.478387
212   99.200012 -6.566332
204   67.462536 -4.994269
177  120.435299 -6.125227
92   125.594800 -6.699715
210   63.899406 -4.055854
268   68.053434 -4.037159
201  133.915623 -6.786009
255   78.692978 -4.262876
273   80.826720 -4.481234
249   90.353950 -4.188984
238   97.372830 -3.969175
248   84.202629 -3.894503
208  104.325471 -4.209675
258  265.856493 -5.741356


So this appears to work reasonably well. For theoretical reasons in this context I also want to look at an asymptotic growth function additionally constrained with asymptote a constant (=100), i.e. with only the rate-constant/half-life free. I'm not sure how to modify the built-in SSasympOrig function to achieve this however thought this would work:

> m2 <- nlsList(y~100*(1-exp(-exp(lrc*Days))), start=list(lrc=-5), data=na.omit(results)) 

but this results in the error message

Error in nlsModel(formula, mf, start, wts) : 
 singular gradient matrix at initial parameter estimates

for every estimation

I realise that constraining the asymptote will force large changes in the estimate of lrc (e.g. particularly in the first case ID == 176) but many of the free-floating estimates of Asym are of the order of  ~ 100 so I'm not sure why the constrained nls model doesn't converge on at least some occasions? Am I doing something else wrong?

Thanks

Rob


More information about the R-help mailing list