1

I am having a problem using augPred after I have created an nlme object.  My data is 529 rows long with no NA's, and is grouped with this function:

RSize.gD.100 <- groupedData(area ~ size | ID, data = RSize)

Under the grouping factor “ID”, this is a character column with 6 levels.

I create my nlsList object with the selfStarter NLS.expoDecay():

fm1R.list <- nlsList(area ~ NLS.expoDecay(size, a, k) | ID, data = RSize.gD.100)

and then my nlme with:

fm1R.nlme <- nlme(fm1R.list)

Following the methods of Pinheiro and Bates (2000), I try to plot my predicted values against my actual values using:

plot(augPred(fm1R.nlme, level=0:1))

But it returns this error:

Error in [[<-.data.frame(*tmp*, nm, value = c(2L, 2L, 2L, 2L, 2L, : replacement has 529 rows, data has 6

I cannot find any suggestions on other threads. Any help would be much appreciated!!

Thank you!

Ben
  • 11
  • 1

1 Answers1

0

I think I can answer your question - I had the same issue today. Make sure the replacement data has the correct structure - numeric and especially as.factor(). In the nlme package use str(Orthodont) to look at the structure and build your data in a similar structure. Classes nfnGroupedData, nfGroupedData, groupedData and data.frame: 108 obs. of 4 variables:

 $ distance: num  26 25 29 31 21.5 22.5 23 26.5 23 22.5 ...
 $ age     : num  8 10 12 14 8 10 12 14 8 10 ...
 $ Subject : Ord.factor w/ 27 levels "M16"<"M05"<"M02"<..: 15 15 15 15 3 3 3 3 7 7 ...
 $ Sex     : Factor w/ 2 levels "Male","Female": 1 
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129