Logarithmic Regression Calculator: Fit y = a + b·ln(x) Free

This free logarithmic regression calculator fits the curve y = a + b·ln(x) to your data and instantly returns the equation, the R² goodness-of-fit, a scatter plot with the fitted curve, and a tool to predict y for any new x. Enter your X and Y values below to get started.

ŷ = a + b · ln(x)
Intercept a
Coefficient b
Correlation r
Data points n
10 paired values loaded. Press Run regression.
Free tool by mlforbeginners.com · embed it: <iframe src="https://mlforbeginners.com/logarithmic-regression-calculator/"></iframe>

What is logarithmic regression?

Logarithmic regression fits a curve of the form \( y = a + b\ln(x) \) to your data. It is the right model when your response variable rises (or falls) quickly at first and then levels off — a pattern of diminishing returns that a straight line cannot capture. Common examples include learning curves, reaction times, dose–response relationships, and many growth processes that saturate over time.

To use this free logarithmic regression calculator, paste your X (predictor) and Y (response) values into the two boxes above and press Run regression. You instantly get the fitted equation, the coefficient of determination R², a scatter plot with the fitted curve, and a tool to predict y for any new x. Everything runs in your browser — nothing is uploaded.

How it is calculated

The trick is that logarithmic regression is just linear regression on the log of x. The calculator transforms each predictor with \( u = \ln(x) \), then fits an ordinary least-squares line \( y = a + b\,u \). The slope b and intercept a come straight from the least-squares formulas:

\( b = \dfrac{\sum (u_i-\bar u)(y_i-\bar y)}{\sum (u_i-\bar u)^2}, \qquad a = \bar y - b\,\bar u \)

Because we take \( \ln(x) \), every X value must be greater than zero — the calculator will warn you if any value is not.

Reading the results

  • Coefficient b — how much y changes for each unit increase in \( \ln(x) \). A positive b curves upward and flattens; a negative b curves downward.
  • Intercept a — the predicted value of y when \( \ln(x)=0 \), i.e. at \( x=1 \).
  • — the share of the variation in y explained by the model, from 0 to 1. Closer to 1 means a better fit.
  • Correlation r — the strength and direction of the relationship between \( \ln(x) \) and y.

Logarithmic vs. linear vs. exponential

Pick the model that matches the shape of your scatter plot. A linear fit (\( y = a + bx \)) is for constant-rate change; an exponential fit (\( y = a\,e^{bx} \)) is for accelerating growth; a logarithmic fit (\( y = a + b\ln x \)) is for fast-then-flattening growth. If your data shoots up and then plateaus, logarithmic regression is usually the best of the three. You can sanity-check the alternative with our linear regression calculator.

When should you use logarithmic regression?

Choose logarithmic regression whenever a scatter plot rises (or falls) quickly and then flattens out — the tell-tale signature of diminishing returns. Learning curves, reaction times, sensor calibration, dose–response relationships, and many biological growth processes that saturate over time all follow this shape. Fitting a straight line to that kind of data would systematically under- and over-predict at the ends, while an exponential curve would shoot off in the wrong direction. Because the logarithmic model is simply ordinary least squares applied to the natural log of x, it inherits all the familiar regression diagnostics, including R² and residual analysis. You can read more about the underlying method in this overview of regression analysis on Wikipedia.

Frequently asked questions

What is the logarithmic regression equation? It is \( y = a + b\ln(x) \), where a is the intercept and b is the coefficient on the natural log of x. This calculator estimates a and b by least squares.

Can X be zero or negative? No. The model uses \( \ln(x) \), which is only defined for \( x>0 \), so every predictor value must be positive.

What does a high R² mean? R² close to 1 means the logarithmic curve explains most of the variation in your data — a good fit. A low R² suggests a different model may describe the data better.

How is logarithmic regression different from linear regression? Logarithmic regression is ordinary linear regression performed after replacing x with ln(x), so it can model curves that flatten out rather than straight-line trends.

Scroll to Top