[R] help with nlme function

Bill Shipley bill.shipley at usherbrooke.ca
Fri Nov 10 15:13:13 CET 2006


Hello.  I am trying to fit a nonlinear mixed model involving 3 parameters.
I have successfully made a self-starting function.  getInitial() correctly
outputs the initial estimates.  I can also use the nlsList with this
function to get the separate nonlinear fits by group.  However, I get an
error message when using the nlme function.  Here is the relevent code:

fit<-nlsList(photosynthesis~photo(irradiance,Q,Am,LCP)|species/plant/leaf,da
ta=marouane.data,
+ na.action=na.omit)

This works, showing that the function "photo" works as a self-starting
function.

nlme(model=photosynthesis~photo(irradiance,Q,Am,LCP),
+ data=marouane.data,fixed=Q+Am+LCP~1,
+ random=Q+Am+LCP~1|species,na.action=na.omit)
Error: subscript out of bounds

This is what happens when I use the nlme function.  I don't know what
"subscript out of bounds" means but I assume that there is something wrong
with the syntax of my code.

The data frame (marouane.data) has dimensions of 1000 and 9.  The first
three columns give the group structure (species, plants within species,
leaves within plants).  "species" is a factor while "plants" is coded 1 or 2
and "leaves" is also coded 1 or 2.  The other columns give values of
measured variables.

Could someone explain what I am doing wrong?  Alternatively, is there
another text besides Pinheiro & Bates that explains the basic syntax of the
nlme function?

Thanks.
Bill Shipley



More information about the R-help mailing list