Hi Everyone,

I am trying to use NLS to fit a dataset using a Kappa function, but I am
having problems.  Depending on the start values that I provide, I get
either:

Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model

Or

Error in nls(FldFatRate ~ funct3(MeanDepth_m, h, k, z, a), data = data1, :
singular gradient

I think these error results from the fact that I obtained a good fit with a
logistic function and that the Kappa reduces to a logistic in the limit with
k -> 0. This causes a problem because the Kappa function has a term raised
to (1/k)th power leading the numerical singularlity for low values of k.
(Since the logistic function gave a good fit, then I am sure that best fit
value for k is very small.) If so, this problem would intractable, but I
thought I see what response I got from other users before giving up on this
track.

Here are a few lines from the command line:

> funct3
function(x, h, k, z, a) { (1 - h*(1 - k*(x - z)/a)^(1/k))^(1/h) }

> reg24 <-nls(FldFatRate ~ funct3(MeanDepth_m, h,k,z,a), data=data1,
+ start=list(h = -17, k = .05, z = 22, a = 3.7), trace=TRUE,
control=nls.control(minFactor=.00009))
24.69316 : -17.00 0.05 22.00 3.70
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model

> reg24 <-nls(FldFatRate ~ funct3(MeanDepth_m, h,k,z,a), data=data1,
+ start=list(h = -18, k = -.00008, z = 24, a = 3), trace=TRUE,
control=nls.control(minFactor=.00009))
19.20454 : -1.8e+01 -8.0e-05 2.4e+01 3.0e+00
Error in nls(FldFatRate ~ funct3(MeanDepth_m, h, k, z, a), data = data1, :
singular gradient

I've also tried setting algorithm to "plinear" and "port" but still get the
same response.  I've also tried numerous possible starting values, include
large values for k and h.

I really appreciate any advice that anyone might have with this issue.

Thanks,

Ezra

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to