Displaying 1 result from an estimated 1 matches for "nrhyperbol".
Did you mean:
nrhyperbola
2004 Jul 16
0
specifying a complex function in nls
...erbola, otherwise fit a constant.
Here is the function that I wrote. “a” is the non-rectangular hyperbola
and “b” is the constant. When I give this to nls() I get an error
message stating:
Error in nlsModel(formula, mf, start) : singular gradient matrix at
initial parameter estimates
> NRHyperbolic.cut
function (Am,alpha,theta,Rd,I,Icut,const)
{
b<-rep(1e6,length(I))
yes<- (I>=Icut)
vec<-as.numeric(yes)
a<-(1/(2*theta))*(alpha*I+Am-sqrt((alpha*I+Am)^2-4*theta*alpha*I*Am))-Rd
b[yes]<-vec[yes]*rep(const,length(I[yes]))
apply(cbind(a,b),1,min)
}
This is a non-re...