Skip to content

fit a deterministic function to observed data

2 messages · vincent laperriere, Gabor Grothendieck

#
Plotting y vs. x:

	plot(y ~ x)

the graph seems to be flattening out at x = 0 at a level of around y =
500 so lets look at:

	plot(500-y ~ x)

This curve is moving up rapidly so lets take the log to flatten it out:

	plot(log(500-y) ~ x)

That looks quite linear so log(500-y) = A + B * x and solving:

	y = 500 - exp(A + B*x)

The 500 was a just a ballpark so lets make that a parameter too:

	y = C - exp(A + B*x) = C - exp(A) * exp(B*x) = C + D * exp(B*x)

where we have replaced -exp(A) with D.

Fitting this gives:
Nonlinear regression model
  model:  y ~ cbind(1, exp(B * x))
   data:  parent.frame()
       B    .lin1    .lin2
  0.1513 498.9519  -5.1644
 residual sum-of-squares: 627.6

Number of iterations to convergence: 6
Achieved convergence tolerance: 6.192e-06
On Mon, Apr 19, 2010 at 8:42 AM, vincent laperriere
<vincent_laperriere at yahoo.fr> wrote: