[R] fitting a hyperbole
Rolf Turner
r.turner at auckland.ac.nz
Sun Sep 21 22:58:00 CEST 2008
On 21/09/2008, at 10:38 AM, Peter Dalgaard wrote:
> stephen sefick wrote:
>> I am not sure if I am exaggerating or not read title as hyperbola
>>
>> On Sat, Sep 20, 2008 at 2:20 PM, stephen sefick
>> <ssefick at gmail.com> wrote:
>>
>>> I have got a data set that is Gross Primary Productivity ~ Total
>>> Suspended Solids it is a hyperbola just like:
>>> plot(1/c(1:1000))
>>>
>>> how do I model this relationship so that I can get all of the neat
>>> things that lm gives residuals etc. etc. so that I can see if my
>>> eyeball model stands up. Thanks for any help, pointers, or good
>>> things to read.
>>>
> Well, it depends on the exact model you want to fit and the error
> characteristics.
>
> There's a straightforward linear model in the transformed x:
> lm(y ~ I(1/x))
>
> but there are also transformed models like
>
> lm(1/y ~ x)
>
> or
>
> lm(log(y) ~ log(x))
>
> but of course, y, 1/y, and log(y) can't all be homoscedastic normal
> variates. Going beyond the linearized models, you can use nls(), as in
>
> nls(y~ a/(x-b), start=c(a=1,b=0))
>
> (which is linear for 1/y, but assumes that y rather than 1/y has
> constant variance.)
Nicely expressed. Succinct, clear, to the point, comprehensive. I
wish I'd said that!
(And that's not hyperbole. :-) )
So much more helpful than some postings I've seen recently to the
effect of ``Go away
and read a book on this topic.''
cheers,
Rolf
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
More information about the R-help
mailing list