[R] newbie question: fitting power law

Thomas Hoffmann hoffmann at giub.uni-bonn.de
Tue Aug 5 16:14:05 CEST 2003

Dear R-helpers, dear Andrew

Andrew C. Ward schrieb:

>Dear Thomas,
>I wonder if you have any NAs in xy$x or xy$y. 
The Dataframe looks like the following:
 > xy
   x          y
1 3.0  121.50951
2 2.0   30.61258
3 4.0  323.14837
4 8.2 3709.92471
For testing reasons I calculated y by:
 > y <- 2.9 x^3.4

>Also, I think
>you could take logs of your equation and end up with a
>linear expression?
if I use:

plot (x,y)
abline lm ( log(y)~log(x),xy)

the line does not seem to fit the plotted datapoints at all. While the 
fitted exponent seems to be okay, the obtained intercept value is wrong.

Thanks for your answer.

Thomas H.


More information about the R-help mailing list