[R-sig-ME] Error when fitting with nlme

Gang Chen gangchen6 at gmail.com
Tue May 13 22:47:16 CEST 2008


I'm getting the following error message

Error in nlmeCall[[i]] <- NULL : subscript out of bounds

when running the following non-linear mixed-effects model:

> library(nlme)
> GrpData <- read.table("GroupData.txt", na.strings = "NA", header=TRUE)
> fm <- nlme(fCR ~ SSasymp(Tr, Asym, R0, lrc), data=www, fixed = Asym+R0+lrc~1, na.action = na.exclude, random = subj~1)

I'm clueless about what the error message means. Does it have anything
to do with the NA's problem indicated as below?

> www <- groupedData(fCR ~ Tr|subj, data=GrpData)
> FitList <- nlsList(fCR ~ SSasymp(Tr, Asym, R0, lrc), data=www, na.action = na.exclude)
Error in numericDeriv(form[[3]], names(ind), env) :
  Missing value or an infinity produced when evaluating the model
In addition: Warning message:
In log(-coef(lm(log(ydiff) ~ x, data = xy))[2]) : NaNs produced
Call:
  Model: fCR ~ SSasymp(Tr, Asym, R0, lrc) | subj
   Data: www

Coefficients:
        Asym        R0       lrc
S1 0.9430772 0.7075430 -4.617628
S2 0.9810034 0.0604899 -3.356152
S3 0.9851586 0.5392042 -3.030196
S4 1.6158708 0.8594590 -7.742318
S5        NA        NA        NA
S6 0.8411017 0.9881358 -3.726827

Degrees of freedom: 122 total; 107 residual
Residual standard error: 0.09946001

And it hangs there forever when I run the following
> nlme(FitList)

However even if I remove subject S5 from the dataframe, I still get
the same error message:

> GC<-GrpData[GrpData$subj!="S5",]
> GCg<-groupedData(fCR ~ Tr|subj, data=GC)
> (llList<- nlsList(fCR ~ SSasymp(Tr, Asym, R0, lrc), data=GCg, na.action = na.exclude))
Call:
  Model: fCR ~ SSasymp(Tr, Asym, R0, lrc) | subj
   Data: GCg

Coefficients:
        Asym        R0       lrc
S1 0.9430772 0.7075430 -4.617628
S2 0.9810034 0.0604899 -3.356152
S3 0.9851586 0.5392042 -3.030196
S4 1.6158708 0.8594590 -7.742318
S6 0.8411017 0.9881358 -3.726827

Degrees of freedom: 122 total; 107 residual
Residual standard error: 0.09946001

> nlme(fCR ~ SSasymp(Tr, Asym, R0, lrc), data=ll, fixed = Asym+R0+lrc~1, na.action = na.exclude, random = subj~1)
Error in nlmeCall[[i]] <- NULL : subscript out of bounds

And again it hangs there forever when I run the following
> nlme(llList)

I'm not attaching the dataframe because of its moderate size, but I
can send it next time if needed.

Thanks for any suggestions,
Gang




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