Displaying 2 results from an estimated 2 matches for "nrhyperbolainit".
2005 Sep 01
1
making self-starting function for nls
...get the following error message:
> getInitial(photo~NRhyperbola(Irr,theta,Am,alpha,Rd),dat)
Error in tapply(y, x, mean, na.rm = TRUE) :
arguments must have same length
Since I do not explicitly call tapply in my function that makes
NRhyperbola a self-starting function (called NRhyperbolaInit, see
below), I assume that the error is coming from within the mCall function
but I can't figure out where or how.
Would someone who has successfully done this be willing to look at my
code and see where the problem arises?
> NRhyperbolaInit
function(mCall,LHS,data)
{
xy<-sort...
2005 Oct 26
0
self starting function for nonlinear least squares.
...Rd)
{
# Am is the maximum gross photosynthetic rate
# Rd is the dark resiration rate (positive value)
# theta is the shape parameter
# alpha is the initial quantum yeild
#
(1/(2*theta))*
(alpha*Irr + Am - sqrt((alpha*Irr + Am)^2 -4*alpha*theta*Am*Irr))- Rd
}
then creating a function
NRhyperbolaInit<-
function (mCall, LHS, data)
{
xy <- sortedXyData(mCall[["Irr"]], LHS, data)
if (nrow(xy) < 3)
stop("Too few unique irradiance values")
fit <- smooth.spline(xy[, "x"], xy[, "y"])
alpha <- predict(fit, x = 0, de...