I am struggling finding pseudo Code for a non-linear fit of the following function:
$y = a\, x^b$
Package NLS in R does perform well, but utilizing external software is not practicable in my program anymore. I would like to avoid this by implementing a short class by myself. Literature links including the solution are also welcome.
Update: I already have implemented the log transform with linear square fit. That is not the solution I am looking for. I need to implement NLS fit.
Update 2, giving reason why the log transformed method is not sufficient:
My original data:
The log transformed data with a linear model line in red, one can see that the log transformed residuals are a heavy influence:
The original data again, the red line is the power function with parameters derived from the log transformed method, the blue line is the power function predicted with package NLS2 in R:
Clearly the log-transformed residuals have too much influence, the NLS method forces the prediction on the stable part of the model.