s-news
[Top] [All Lists]

help with a self-starting function in nonlinear least squares regression

To: "R help list" <r-help@lists.R-project.org>, "SPLUS_NEWS" <s-news@lists.biostat.wustl.edu>
Subject: help with a self-starting function in nonlinear least squares regression.
From: "Bill Shipley" <bill.shipley@usherbrooke.ca>
Date: Wed, 26 Oct 2005 09:38:27 -0400
Importance: Normal

Hello.  I am having a problem setting up a self-starting function for use in nonlinear regression (and eventually in the mixed model version).  The function is a non-rectangular hyperbola – called “NRhyperbola” – which is used for fitting leaf photosynthetic rate to light intensity.  It has one independent variable (Irr) and four parameters (theta, Am, alpha and Rd).  I have created this to act as a self-starting function.  The self-starting function seems to work (i.e. when I call “getInitial” it provides the initial values), but I can’t get it to work when used within “nls”.  Here is an example:

 

1)

> getInitial(Photosynthese~NRhyperbola(Irr,theta,Am,alpha,Rd),data="">1:11,])

        theta            Am         alpha            Rd

 0.5021546914  3.7466359015  0.0005743723 -3.0685671752

 

So, “getInitial” succeeds in extracting the initial values from the function.

 

2)

> nls(Photosynthese~NRhyperbola(Irr,theta,Am,alpha,Rd),data="">1:11,])

Error in eval(expr, envir, enclos) : Object "theta" not found

 

But the call to “nls” does not find the parameter theta, even though the call “getInitial” did find it and returned its initial value.

 

I am working from the Pinheiro & Bates book on mixed-effects models in S and S-PLUS.  According to that book (p. 346): “When nls is called without initial values for the parameters and a self-start model function is provided, nls calls getInitial to provide the initial values.”

 

Two questions:

 

1)       what am I doing wrong?

2)       When a self-Starting model is called from within nlsList or nlme, is getInitial only called one (to get the values ignoring any hierarchical structure in the data) or is it called for each group?

 

Thanks.

 

Bill Shipley

 

<Prev in Thread] Current Thread [Next in Thread>
  • help with a self-starting function in nonlinear least squares regression., Bill Shipley <=