[R] how to code y~x/(x+a) in lm() function

Rolf Turner rolf.turner at xtra.co.nz
Tue Aug 20 23:45:36 CEST 2013


(1) It is not acceptable to use "wanna" in written English.  You should say
      "I want to fit a model ....".

(2) The model you have fitted is *not* equivalent to the model you first 
state.

If you write "y ~ x/(a+x)" you are tacitly implying that

     y = x/(a+x) + E

where the "errors" E are i.i.d. with mean 0.

If this is the case then it will *not* be the case that

     1/y = 1 + a/x + E

with the E values being i.i.d. with mean 0.

If the model "y ~ x/(a+x)" is really what you want to fit, then you should
be using non-linear methods, e.g. by applying the function nls().

     cheers,

     Rolf Turner


On 21/08/13 09:39, Ye Lin wrote:
> Hey All,
>
> I wanna to fit a model y~x/(a+x) to my data, here is the code I use now:
>
> lm((1/y-1)~I(1/x)+0, data=b)
>
> and it will return the coefficient which is value of a
>
> however, if I use the code above, I am not able to draw  a curve the
> presents this equation. How can I do this?



More information about the R-help mailing list