[R] fitting a hyperbole

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Sep 21 00:38:03 CEST 2008


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.)

>> --
>> Stephen Sefick
>> Research Scientist
>> Southeastern Natural Sciences Academy
>>
>> Let's not spend our time and resources thinking about things that are
>> so little or so large that all they really do for us is puff us up and
>> make us feel like gods. We are mammals, and have not exhausted the
>> annoying little problems of being mammals.
>>
>>        -K. Mullis
>>
>>     
>
>
>
>   


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list