views:

60

answers:

3

Hi. I want to fit a power function to a dataset. I'm using this method: http://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html

But the result is not acceptable: b = -0,001901, a = 7,26



My dataset:

8553600  458.2
17193600    373.6
25833600    694.16
34646400    738.33
44064000    817.89
54259200    1040.67
67910400    1032.69
76291200    1222.1
84844800    1245.65
94089600    1217.44
102211200   1579.38
110592000   1859.24
118886400   1711.67
127612800   2303.62
136684800   2658.26
219196800   3669.23
225676800   3525.02
225763200   3749.27

Is this method inadequate, or did i make a miastake? Is there a better solution to do this?

+1  A: 

Fitting methods are "garbage in, garbage out" methods: you should first convince yourself that there is a relation like the one you're trying to fit. In you case, make a scatter plot, and see if it looks like a power function. It just might be that you have to add a constant, or chose the wrong exponent. In general there's no way to estimate a relation easily. The best way to start is to find theoretical arguments why a certain relation should hold, and try to estimate the parameters of that relation.

Martijn
A: 

Your data looks more like a linear function than a power law. You would obtain a better fit by fitting it with f(x) = a*x+b.

EOL
A: 

I think you just implemented it wrong.

The denominator for B is

n*sum( x_i ^2 ) - (sum( x_i ))^2

whereas it looks like you did

n*sum( x_i )^2 - (sum( x_i))^2
Rex Kerr
Truth. This calculations I posted were from oO Calc. I can't send this amount of data which my program uses. That's why i prepared a simple Calc sheet. Even though the programm is ok, it still gives unsatisfactory results. If You're interested in this topic, I wrote also on: http://math.stackexchange.com/questions/3625/easy-to-implement-method-do-fit-a-power-function-regression. I try to extend it with the Levenberg-Marquardt algorith.
czerasz
@czerasz - You are getting values around 0.7 for the exponent for the data above, correct? Otherwise, there's still an implementation error. Also, L-M will let you do fancier things like A*x^B+C, but for solutions with zero at zero, if the least squares solution routinely gets it wrong, all improved fitting methods will likely get it wrong.
Rex Kerr
Funny thing. I reduced the data set to about 50 points in my programm. Now I get this function: 270453.6012632227*x^-0.23699895219606074, what is lot better than earlier. I also had a bug in the code.
czerasz