There is a question about exponential curve fitting, but I didn't find any materials on how to create a power curve fitting, like this:
y = a*x^b
There is a way to do this in Excel, but is it possible in Python?
If you do an easy transformation you can apply the usual least squares regression.
Instead of this equation:
y = a*x^b
Take the natural log of both sides:
ln(y) = ln(a*x^b) = ln(a) + ln(x^b) = ln(a) + b*ln(x)
This is a linear equation in [ln(x), ln(y)] with slope b and intercept ln(a).
You can use out of the box least squares fitting on the transformed data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With