[R] starting point for non linear fitting

From: nelson - <nelson1977_at_gmail.com>
Date: Thu 28 Sep 2006 - 08:33:36 GMT

Hi all!
 i'm trying to use nls for fitting my data. I wrote this code to find some minimum, but it fails, returning 0 every time..... and i can't figure out the problem... any advice?

grid <- expand.grid(A0 = seq(1000,10000,1000), A1 = seq(0,2,0.1)) exp.approx <- function(x,A0,A1) {
  A0 * exp(- x*A1)
ss <- function(p) {

                   sum((durata.h.freq - exp.approx(durata.h.x,p[0],p[1]))^2)}

idx <- which.min(apply(grid,1,ss))

idx is always 1,1... and that's not true...

R-help@stat.math.ethz.ch 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. Received on Thu Sep 28 18:37:25 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 28 Sep 2006 - 10:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.