How to curve fit a logarithmic data set

1.5k Views Asked by At

I've got a dataset with a clear logarithmic relationship, however, I need the equation that describes the relationship.

I think that it will take the form $f(x) = a \cdot log_b(x) + c$.

I would like to know what the best method would be of finding the coefficients $a, b$ & $c$ ($b$ being the logarithm's base).

I found this answer which is close to what I need but not quite the same as it is specifically using base $e$ whereas I don't know what my base is:

How to fit logarithmic curve to data, in the least squares sense?

1

There are 1 best solutions below

0
On BEST ANSWER

This is probably obvious to most people but took me a bit of head scratching to get straighten out what the comments meant so thought I'd work it through explicitly below. Also needed an answer so that I could mark as solved.

In fact $log_bx = \frac{lnx}{lnb}$, so the choice of $b$ can be absorbed into $a$. – Rahul Dec 12 at 14:13


$f(x) = a \cdot log_b(x) + c$

$log_b(x) = \frac{ln(x)}{ln(b)}$

$f(x) = a \cdot \frac{ln(x)}{ln(b)} + c$ = $\frac{a}{ln(b)} \cdot ln(x) + c$

A = $\frac{a}{ln(b)}$

B = c

$f(x) = A \cdot ln(x) + B$


And the rest of the solution can be found here:

How to fit logarithmic curve to data, in the least squares sense?