log regression calculator

Logarithmic regression uses ln(x), so every x value must be greater than 0.

A logarithmic regression model is useful when your data rises (or falls) quickly at first and then gradually levels out. This calculator fits the model:

y = a + b ln(x)

It estimates a (intercept) and b (slope on ln(x)) using least squares, then reports goodness-of-fit metrics so you can quickly judge whether a log model is a reasonable choice.

What is log regression?

Log regression (more precisely, logarithmic regression) describes a relationship where the response variable changes linearly with the natural log of the predictor. Instead of assuming straight-line growth with x, it assumes straight-line growth with ln(x).

  • If b > 0, y increases as x increases, but with diminishing increments.
  • If b < 0, y decreases as x increases.
  • If b ≈ 0, x may not meaningfully explain y under this model.

When should you use a logarithmic model?

Choose this model when changes are fast early and slower later, such as learning curves, market saturation effects, and some biological adaptation processes.

Good practical signals

  • Scatter plot looks curved but flattens over time.
  • Plotting y versus ln(x) looks close to linear.
  • You need a simple interpretable model rather than a high-complexity algorithm.

How to use this calculator

  1. Enter positive x values in order you measured them.
  2. Enter y values with the same number of points.
  3. Optionally enter a future x value for prediction.
  4. Click Calculate Regression.

The tool returns the equation, R², RMSE, sample size, and optional prediction value.

How the math works

We transform each x into z = ln(x), then run simple linear regression between z and y:

y = a + b z where z = ln(x)

From that, the final model is:

y = a + b ln(x)

This transformation keeps the model easy to estimate while capturing nonlinear behavior in the original x scale.

Interpreting results correctly

Coefficient b

b is the expected change in y for a one-unit increase in ln(x), not a one-unit increase in x directly. In plain language, equal percentage-like expansions in x can have similar marginal impacts on y.

R² and RMSE

  • : Proportion of variance explained by the model (closer to 1 is better).
  • RMSE: Typical prediction error size in y-units (smaller is better).

Common mistakes to avoid

  • Using zero or negative x values (ln is undefined there).
  • Comparing models solely by R² without inspecting residual behavior.
  • Extrapolating far beyond observed x values.
  • Confusing logarithmic regression with logistic regression.

Quick FAQ

Is this the same as logistic regression?

No. Logistic regression is for classification probabilities. This calculator performs logarithmic curve fitting for continuous y outcomes.

Which log base is used?

Natural log (base e) is used. If needed, other log bases can be converted by a constant scaling factor in the slope.

Can I use this for forecasting?

Yes, for cautious short-range forecasting when your process reasonably follows diminishing returns. Always validate with out-of-sample checks when possible.

🔗 Related Calculators