Power function fit
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 m开发者_开发百科ethod inadequate, or did i make a miastake? Is there a better solution to do this?
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.
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
.
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
精彩评论