Re: [R] fitting power growth

2012-07-11 Thread Yasir
read the part on power fitting:
http://www.itc.nl/~rossiter/teach/R/R_CurveFit.pdf


--
View this message in context: 
http://r.789695.n4.nabble.com/fitting-power-growth-tp4635999p4636158.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] fitting power growth

2012-07-10 Thread Thomas Hoffmann

Dear all

I am using the x and y vectors as defined below and want do to a power 
law regression:


y = a x^b

using
> lm(log(y)~log(x))

gives reasonable values (b=1.23) but is not very popular due to biases 
of back-transformation from log to non-log values.  Using


> nls(y~a*x^b,start=list(a=100,b=1.23))

is statistically more correct but gives a too large "a" value and a too 
small "b" value.



Doe anybody have a better way to solve the above power-law regression 
(using for instance maximum likely hood or anything else).


Kind regards for your help
Thomas



> x
 [1]   744.90   806.40   838.00   910.70  1818.60  2870.10  4070.00 
4476.80  4857.60  4858.10
[11]  5916.40 13970.80 27306.60 28226.60  2532.10  2658.40 18863.10   
758.0054.0079.00
[21]   139.0046.70  1003.0024.00   106.00   186.00 1503.00   
228.0010.24   162.00

[31]   381.70   312.60   209.00   246.00   221.20  1151.55
> y
 [1] 1.500e+08 2.850e+08 1.800e+08 1.800e+08 6.300e+08 7.200e+08 
1.170e+09 1.095e+09 1.620e+09
[10] 4.650e+09 1.575e+09 4.200e+09 7.755e+09 8.745e+09 9.900e+08 
6.600e+08 1.077e+10 3.450e+08
[19] 1.350e+07 2.550e+07 6.600e+07 6.000e+06 3.300e+07 1.500e+06 
4.500e+06 7.500e+06 2.415e+08
[28] 6.900e+07 9.000e+05 9.450e+06 3.510e+07 4.880e+07 3.100e+06 
1.930e+07 2.270e+07 5.270e+07


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.