1. Fit a simpler model -- you're probably overfitting.
2. Consult your local statistician.
3. Post to stats.stackexchange.com, as this appears to be primarily a
statistical issue, not an R issue. But 2) would probably be better.
Cheers,
Bert
On Sun, Dec 16, 2012 at 3:57 PM, Diviya Smith
<diviya.smith@gmail.com>wrote:
> Hi there,
>
> I am trying to fit the following model with a sum of exponentials -
>
> y ~ Ae^(-md) + B e^(-nd) + c
>
> the model has 5 parameters A, b, m, n, c
>
> I am using nls to fit the data and I am using DEoptim package to pick the
> most optimal start values -
>
> fm4 <- function(x) x[1] + x[2]*exp(x[3] * -dist) + x[4]*exp(x[5] *
-dist)
>
> fm5 <- function(x) sum((wcorr-fm4(x))^2)
>
> fm6 <- DEoptim(fm5, lower=c(0,0.1,1,0.1,1), upper=c(10e7, 100, 300,100,
300
> ), control=list(trace=FALSE))
>
> par2 <- fm6$optim$bestmem
>
> names(par2) <- c("c", "A", "n1",
"B", "n2")
>
> fit2 <- nls(wcorr ~ (c + A*exp(n1 * -dist) + B*exp(n2 * -dist)),
> start=par2,control
> =list(maxiter=1000, warnOnly=TRUE))
>
> However, I keep getting the following error -
>
> Error in numericDeriv(form[[3L]], names(ind), env) :
>
> Missing value or an infinity produced when evaluating the model
>
> OR
>
> In nls(wcorr ~ (c + A * exp(n1 * -dist) + B * exp(n2 * -dist)), :
>
> singular gradient
>
>
> Can anyone suggest how to resolve the problem?
>
>
> Thanks,
>
> Priya
>
> [[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.
>
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
[[alternative HTML version deleted]]