[R] Curve fitting

Ben Bolker
Thu, 12 Jan 2006 19:00:07 -0000

<ndurand <at> fr.abx.fr> writes:

>
> Hi!
>
> I have a problem of curve fitting.

>
>  I perform parametric fits using custom equations
>
> when I use this equation :   y  =  yo + K *(1/(1+exp(-(a+b*ln(x)))))   the
> fitting result is OK
> but when I use this more general equation :    y  =  yo + K
> *(1/(1+exp(-(a+b*log(x)+c*x))))  , then I get an aberrant curve!
>
> I don't understand that... The second fitting should be at least as
good
> as the first one because when taking c=0, both equations are identical!
>

  Can you specify *exactly* what R code you're using?
Are you using nls()?

  You're trying to fit a five-parameter model to
five data points, which is likely to be difficult if
not impossible to do statistically.  Furthermore, your
data points don't have very much information in them
about all the parameters you're trying to estimate --
they are steadily decreasing, with very mild
curvature.  Finally, if these "data" happen to be
points that you have generated as theoretical
values, without adding noise, nls will give you
problems (see ?nls).

  If you give us more detail about what you're trying
to do we might be able to help (or possibly tell you
that it really can't work ...)

  Ben Bolker