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