jackson marshmallow said:
jackson marshmallow said:
Jos A. Horsmeier said:
Hello everyone,
Is there a free Java implementation of an exponential regression algorithm
(i.e. to generate exponential regression function coefficients for
f(x)
=
A*exp(B*x)+C)?
The excellent JSci package has linear and polinominal regressions, but not
exponential...
If there is not, I will need to write one... Any advice will be
appreciated...
If you get rid of the horizontal asymptote C (by inspecting the data
samples and finding an approximate value C'), your equation yields:
f'(x) [= f(x)-C'] = A*exp(B*x)
taking the logarithm on both sides reduces your problem to linear
regression again.
kind regards,
Jos
That will yield wrong results.
PS Sorry Jos, I was in a rush and didn't mean to be rude... I do appreciate
your reply.
I didn't consider it rude; a bit concise though ;-) But you're right, if
your estimate for the horizontal asymptote C' is way off, the results will
be way off also ...
Basically, I have been doing something like what you are describing, which
was better than nothing and was easy to code. But what's needed a true
exponential fit.
If your sample set is large *and* if the condition number of the resulting
matrix is low (i.e. the fit will be 'fine') a better estimate can be
made for C by elliminating it all together; have a look:
f(x) = A*exp(B*x)+C
f'(x) = A*B*exp(B*x)
(where f'(x) is the derivative of f(x) w.r.t. x)
given your sample value set (x_0, y_0) ... (x_i, y_i) ... (x_n, y_n),
the derivative values can be estimated as follows:
f'(x_i) = (y_i+1-y_i)/(x_i+1-x_i)
The value for C can be estimated then by taking the average of all
the C'_i values from your sample set.
kind regards,
Jos