[R] help with syntax of nlme function
Spencer Graves
spencer.graves at pdf.com
Sun Jun 4 22:02:26 CEST 2006
I haven't seen a reply to this, so I will offer a few comments. I'm
not sufficiently familiar with nlme to answer your question directly,
but I hope my comments might help.
First, have you studied Pinheiro and Bates (2000) Mixed-Effects
Models in S and S-Plus (Springer)? If no, I highly recommend this book
for you. It has three chapters with many examples on nonlinear
mixed-effects models. The nlme package is the product of Doug Bates and
many of his graduate students, including Jose Pinheiro. For over a
quarter century, Doug Bates has been a leading, original contributor to
the theory and practice of nonlinear and mixed-effects modeling. I was
unable to get much out of lme (let alone nlme) until I read this book.
If you are not familiar with this book, I believe it will introduce you
to many "helper" functions that will make it easier for you to produce
plots as well as p-values, etc., for your model. This in turn should
help you get more information from your data and be able to describe
your results more persuasively and interestingly to your audience.
Also, can you check the directory on your computer where R is
installed? It should have a subdirectory "library" that includes a
further subfolder "nlme". The "script" folder in "nlme" contains script
files containing R commands to produce most of the computer output in
the book. Ch. 7 is a lot of math that you may wish to skip. However,
if you work through the script files while reading chapters 6 and 8, you
will hopefully find examples that are sufficiently close to your current
application that you will be able to find and fix the problem.
If that fails, try to find a simple, self-contained reproducible
example that also displays your problem. With luck, you should be able
to generate such by modifying one of the examples in the book, by
reducing the size of the data set used or misspelling a name or
something. Then submit another post containing this example.
I'm sorry I can't give you a quicker answer.
Hope this helps,
Spencer Graves
Bill Shipley wrote:
> I am having difficulty understanding the syntax of the nlme() function for
> nonlinear mixed models. The data frame is called Marouane.chlorophyll. The
> model involves a dependent variable (Absorb) and an independent variable
> (Ch.surf), which are both numeric variables in the data frame. The data are
> hierarchically grouped as Espece, Plante nested within Espece, and Feuille
> nested within Plante (i.e. leaves within plants within species). Espece is
> defined as a factor and Plante and Feuille are defined as numeric in the
> data frame. There are two parameters (k1 and b) and I want to fit a model
> in which these two parameters vary randomly across Espece and Plante (with
> Feuille being the residual level). Here is how I have specified the call to
> nlme:
>
>> fit<-nlme(model=Absorb~ k1 - (1/(b*Ch.surf)),
> + data=Marouane.chlorophyll,fixed=k1+b~1,
> + groups=~Espece/Plante,
> + start=list(k1=97.8, b=4.68))
>
> However, there is something wrong with this syntax because I get the
> following error:
>
> Problem in names<-: Invalid length for names attribute: structu
> re(.Data = list(structure(.Data = numeric(0), class ....
>
> Can someone explain what I am doing wrong?
>
>
>
> Bill Shipley
>
> North American Editor, Annals of Botany
>
> Editor, "Population and Community Biology" series, Springer Publishing
>
> Département de biologie, Université de Sherbrooke,
>
> Sherbrooke (Québec) J1K 2R1 CANADA
>
> Bill.Shipley at USherbrooke.ca
>
> http://callisto.si.usherb.ca:8080/bshipley/
>
>
>
>
>
> [[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
More information about the R-help
mailing list