[R] nlme Error: Subscript out of bounds

Spencer Graves spencer.graves at pdf.com
Sat Nov 4 03:59:51 CET 2006


      I can't begin to guess.  If your example were self contained (and 
preferably simple), it would be easier to diagnose. 

      When I have problems like this, I often try to find a simple 
example that produced the same error message.  That process often leads 
me to a solution.  If it doesn't it often produces a sufficiently simple 
example that I can describe it easily in a few lines of a question to 
r-help.  I might also use the 'debug' function (in the 'base' package.  
I have not used the 'debug' package, which may be more powerful but 
possibly harder to use.).  To access a chain of earlier recommendations 
on debug, I tried 'RSiteSearch("graves debug")", then 
'RSiteSearch("graves debug lme")'.  The fifth hit from the latter is 
"http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77298.html". 

      Hope this helps. 
      Spencer Graves

Lisa Avery wrote:
> Hello, I am new to non-linear growth modelling in R and I am trying to
> reproduce an analysis that was done (successfully) in S-Plus.  
>
>  
>
> I have a simple non-linear growth model, with no nesting. I have attempted
> to simplify the call as much as possible (by creating another grouped
> object, instead of using subset= and compacting the fixed and random
> expressions.)
>
>  
>
> This is a what the grouped data object looks like:
>
>  
>
> levelI.data[1:2,]
>
> Grouped Data: GMAE ~ AGE | STUDYID
>
>    STUDYID TIME            SCORE       INCURVES      MOST     FIRST      AGE
>
> 19    1005    1 ACTUAL (unaided) in JAMA curves Level I   Level I   49.11301
>
> 20    1005    2 ACTUAL (unaided) in JAMA curves Level I   Level I   56.53745
>
>        GMFM GMFCS  GMAE      YRS
>
> 19 91.03394     1 74.16 4.092751
>
> 20 95.35018     1 84.05 4.711454
>
>  
>
> Here is the nlme model:
>
>  
>
> cp.grad<-deriv(~ (100/(1+exp(-L)))*(1-exp(-exp(logR)*x)), c("L", "logR"),
> function(x=0:100,L,logR) NULL)
>
> levelI.nlme<-nlme(GMAE~cp.grad(AGE,limit,lograte), 
>
>             data=levelI.data, 
>
>             fixed = limit+lograte~1, 
>
>             random = limit+lograte~1, 
>
>             start = c(2.0, -3.0))
>
>  
>
> I get a subscript out of bounds error  - which I am not finding very helpful
> because I don't know where things are going wrong.
>
>  
>
> Bill Shipley posted a similar problem with nlme called with a self-starting
> function - but here I don't use a self-starting function and I give the
> starting values explicitly so I assume that this is not the same problem he
> is having.
>
>  
>
> What am I doing wrong?  Any insights would be very much appreciated.
>
>  
>
> Kind Regards, Lisa Avery
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list