Math calculator

Logarithmic Regression Calculator

Diminishing returns, reported as what each doubling actually buys.

Diminishing returns, measured per doubling

x must be positive on every row. y may be anything, including zero and negative.

Every doubling of budget buys the same extra conversions — that is what this shape means.

y = -391.164914 + 131.722926·ln x

Every doubling of x adds 91.3034

The same increment at every scale: from 10 to 20, and from 10,000 to 20,000. Ten-fold: +303.3032.

Per doubling of x

+91.3034

b · ln 2

Per ten-fold of x

+303.3032

b · ln 10

b

131.722926

per e-fold of x

a (value at x = 1)

-391.164914

ln 1 is zero

0.999797

in your y units — no caveat

Straight-line R²

0.743146

same data, no transform

Residual std error

3.3973

on 5 degrees of freedom

Rows dropped

0

none

2004006008000500010000xy
The residuals sum to zero — 1.1e-13 in floating point— and that is the point. This model transforms x and leaves y alone, so ordinary least squares is already minimising Σ(y − ŷ)² in the units you measured. The R² above needs no asterisk. An exponential or power fit takes logs of y as well, minimises the wrong quantity, and reports an R² that belongs to the transformed data — their residuals do not sum to zero, and cannot.
At x = 20,000.0000 the curve predicts 913.3514. A logarithmic curve rises without limit but ever more slowly, so it never turns over and never reaches a ceiling. That makes it safer to extrapolate than a parabola, which must reverse — and wrong for any process that genuinely saturates, because it will keep climbing past the ceiling forever.
A straight line scores 0.743146 on this data; the logarithmic fit scores 0.999797. Unlike a quadratic, this is a fair comparison: both models have two parameters, so neither is buying its improvement with an extra degree of freedom. The gap is evidence about shape rather than an artefact of counting parameters.

What this tool shows

Per unit is the wrong denominator for this shape. A logarithmic fit says every doubling of x adds the same amount to y — on the preset here, 91.30 conversions, whether the budget goes from 100 to 200 or from 5,000 to 10,000. It is also the one log-transformed model on this site whose R² comes with no asterisk.

  • y = a + b·ln x by ordinary least squares on ln x
  • What one doubling of x adds to y, and one ten-fold
  • R² in your own y units, with the residual sum shown as proof
  • The straight-line R² beside it — a fair comparison at equal parameters
  • Rows with x ≤ 0 excluded and counted rather than dropped silently
  • Prediction at any positive x, with what the shape does and does not assume
Per doubling R² without a caveat Fair against a line x ≤ 0 counted

The same 91.30 per doubling, from 100 to 200 and from 5,000 to 10,000.

Updated 12 September 2026 · Works in any browser, no installation

Logarithmic regression fits y = a + b·ln x. It is the shape of diminishing returns: y rises without limit but ever more slowly, so it never turns over the way a quadratic must, and never reaches the ceiling a logistic curve would. Because only x is transformed, the fit is ordinary least squares in your original y units.

At a glance

Formula shown
Substituting u = ln x makes the model y = a + bu, so a and b come from ordinary least squares on (u, y) with no back-transform. b is the change in y per e-fold increase in x; b·ln2 is the change per doubling and b·ln10 the change per ten-fold. Rows with x ≤ 0 have no logarithm and are excluded. Because y is untouched, the residuals sum to zero and R² is measured against the data rather than against a transform of it.
Scenario support
Diminishing returns of every kind: advertising spend against conversions, study hours against test scores, sample size against precision, dose against effect above saturation. Also anything measured on a scale that is already logarithmic — decibels, pH, magnitude, bits — where the relationship is logarithmic by definition rather than by fit.
Educational estimate
Planning support from the values you enter — not professional advice.

The right denominator is a doubling, not a unit

“Each extra pound of budget buys X conversions” is a statement a linear model can make. A logarithmic model cannot, and that is the whole reason to fit one.

What is constant here is the effect of multiplying x, not of adding to it. Going from 100 to 200 and going from 5,000 to 10,000 are the same move in this model, because both are a doubling, and both add the same amount to y.

On the ad-spend preset that amount is 91.30 conversions. The fitted b is 131.72 per e-fold, so b·ln2 is 91.30 per doubling and b·ln10 is 303.30 per ten-fold. Those are the numbers a budget conversation actually needs.

Which reframes the marginal question usefully. The next 100 pounds of spend is worth a great deal at a budget of 100 and almost nothing at a budget of 10,000 — not because the model decays, but because 100 is a doubling in the first case and a 1% increase in the second.

a is the fitted value at x = 1, because ln 1 is zero. That is only a meaningful quantity when x = 1 is a sensible point in your data; on a budget measured in thousands it is an extrapolation to a spend of one pound, and should be read as a coefficient rather than as a prediction.

The same arithmetic runs backwards. To find the x that reaches a target y, invert: x = e^((y − a)/b). Because the model is logarithmic, each equal increase in the target costs a constant multiple of the budget — which is usually the finding that ends the conversation.

The one log fit whose R² needs no caveat

This site carries four models fitted through a logarithm, and three of them report an R² that describes transformed data rather than your data. This one does not, and the difference is worth being precise about.

An exponential fit takes logs of y. Least squares then minimises Σ(ln y − ln ŷ)², which is a different objective from minimising error in your units, and the R² that comes out belongs to the log-space regression. On that page’s preset the reported 0.9998 corresponds to 0.9942 on the actual data.

A power fit takes logs of both. Same problem, twice.

This model takes logs of x only, and x is not what is being predicted. Substituting u = ln x leaves an ordinary linear regression of y on u. Nothing is back-transformed, nothing is re-exponentiated, and the least squares that runs is least squares on the quantity you care about.

The residual sum is the visible proof. Residuals of a fit with an intercept sum to exactly zero — it is one of the normal equations. The tool prints that sum, and it is zero here in a way it provably is not for an exponential or power fit on the original scale.

So the comparison against a straight line is also fair. Both models have two parameters and both are fitted by least squares on y, so a higher R² here is evidence about shape rather than the arithmetic consequence of an extra degree of freedom that makes a quadratic always win.

x ≤ 0 has no logarithm, and the gap is usually where the interest is

ln 0 is negative infinity and the logarithm of a negative number is undefined. Any row whose x is not strictly positive cannot enter this fit.

The tool excludes those rows and prints the count. The preset built for this has a row at x = −5 and one at x = 0; the fit describes six points, and the output says so rather than quietly reporting eight points’ worth of confidence.

The excluded row is often the most interesting one. Zero spend, zero dose, zero study time — the baseline is exactly the observation a diminishing-returns curve most wants to anchor on, and the model cannot represent it. It predicts negative infinity there.

Shifting x is the usual workaround and it is not free. Fitting ln(x + 1) gives a curve that passes through the origin, and fitting ln(x + 10) gives a different one. Every coefficient, the R², and the per-doubling figure all depend on the constant you chose, and no data tells you which constant is right. If you shift, say by how much.

Negative x is a signal to stop rather than to patch. This shape assumes a multiplicative scale, and a quantity that goes below zero does not have one. That is a reason to choose a different model, not a reason to translate the axis until the arithmetic works.

y, by contrast, is entirely unconstrained. Zero, negative, anything — y is never transformed. That asymmetry is the same fact as the honest R², seen from the input side.

When the relationship is logarithmic by definition

Some data is logarithmic because the unit was constructed to be. Fitting this model there is not an approximation, and the tool can be checked against the definition.

The decibel preset is the clean case. A sound pressure ratio of r is 20·log₁₀ r decibels, by definition. Feed the tool seven exact ratios and their decibel values and it returns b = 8.685890 with an R² of exactly 1 — and 8.685890 is 20/ln(10) to the last digit a double can hold.

Which makes the per-doubling figure the familiar one. b·ln2 comes out at 6.0206, and +6.02 dB per doubling of pressure is the number every audio reference quotes. The tool derived it from the data rather than being told it.

The same is true of any constructed log scale. pH against hydrogen ion concentration, earthquake magnitude against energy, bits against the number of distinguishable states, stellar magnitude against brightness. In each the relationship is exact and the fit is a check on your data rather than an estimate.

Perceptual laws are the interesting middle ground. The Weber-Fechner relation says sensation grows with the logarithm of stimulus, and Hick’s law says reaction time grows with the logarithm of the number of choices. Those are empirical, they fit well, and they are the reason a logarithmic model is a reasonable default for anything involving human response to scale.

Base does not matter to the fit, only to the reading. ln, log₁₀ and log₂ differ by a constant factor, which is absorbed into b. Choosing a base is choosing how to report: per e-fold, per ten-fold or per doubling. The tool gives all three so the choice does not have to be made before fitting.

Against the shapes it is confused with

Three models produce a curve that rises and flattens, and they make quite different claims about what happens next.

A logarithmic fit rises forever. Slowly, but without bound. Double x enough times and y will pass any value you name. That is right for something with no ceiling and wrong for anything that genuinely saturates.

A quadratic turns over. Fit one to flattening data and it will place a peak somewhere and predict a decline past it, whether or not anything in the data suggested one. The quadratic page has a preset built to show exactly that.

A power fit with an exponent below 1 also flattens, and is often the better description. The difference is the claim: a power law says a constant percentage increase in x gives a constant percentage increase in y, while a logarithmic fit says it gives a constant absolute increase. On a narrow range they are hard to tell apart; over decades they are not.

A logistic curve is what you want if there is a true ceiling. Market saturation, an epidemic reaching the whole population, a skill reaching its limit. None of the three models here can represent an asymptote, and a logarithmic fit will happily predict past one forever.

Fit statistics will not settle it over a short range. All four can score above 0.99 on the same forty points. What separates them is the extrapolation, which is exactly where the data has nothing to say — so the choice is a claim about the mechanism, informed by the fit rather than decided by it.

Comparing them on one screen is the practical route. The R² calculator fits all five families to the same data at once, and the residual calculator shows which of them leaves structure behind.

Reporting it without overstating it

The per-doubling figure is easy to quote and easy to over-extend, in three specific ways.

It is a description of the range you measured. The ad-spend preset covers 100 to 10,000, which is about seven doublings. The model asserts the same increment at a budget of ten million, and that assertion rests on nothing.

It is an association, not a causal effect. Budgets are not randomly assigned. If the biggest campaigns also had the best creative, the fitted curve is picking up both, and doubling a budget on its own will not deliver 91 conversions.

The residual standard error is what to quote alongside it. A per-doubling figure of 91.30 with a residual standard error of 8 is a useful planning number; the same figure with a standard error of 60 is not, and R² alone will not tell the two apart.

Check the residuals for a pattern before trusting the shape. Diminishing returns that are steeper than logarithmic leave a run of negative residuals at the high end. That is the model being too optimistic about large x, and it will not show up in R².

And watch the leverage of your largest x. Because the fit runs on ln x, a point at 10,000 is not a wild outlier in log space the way it is in the original units — but on a small dataset the extreme points still carry most of the weight. The residual calculator reports leverage directly, and a single point at leverage 0.6 is worth knowing about before quoting anything.

Sources and methodology

References for the model and for the scales it describes exactly.

Method. The fit substitutes u = ln x and runs ordinary least squares on (u, y), with no back-transform, which is why the R² and the residual standard error are measured in the units of y rather than of a transform of it. Rows whose x is not strictly positive are excluded and counted rather than dropped silently. The suite asserts that the decibel preset recovers b = 20/ln(10) to within 10⁻¹² with an R² of exactly 1 and a per-doubling figure matching 20·log₁₀2, that the residuals of an intercept fit sum to zero across 400 random datasets while an exponential fit’s provably do not, and that the ad-spend preset’s per-doubling increment is constant across every scale in the data. That engine is verified on every change against 188 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Exponential RegressionFits y = ae^(bx) by true least squares as well as by the usual log-transform, and shows the gap — on the built-in preset the standard method is out by 8% on the doubling time and leaves 4.79 times the squared error.
Power RegressionFits y = ax^b and reads b as what it is — a dimensionless elasticity. Change the units in one click and watch the coefficient move by a million while the exponent holds; fed the eight planets it returns Kepler's 1.4997.
Quadratic RegressionFits y = a + bx + cx² and prints the vertex, which is the optimum a dose-response curve is fitted to find — plus whether that turning point falls inside your data or is being assumed by the shape.
Coefficient of DeterminationR-squared across five models at once with adjusted R-squared beside it, because adding a term can never lower it and the value most tools report for a curve fit was computed in log space.
Linear RegressionThe least-squares line with r and r² — and the regression of x on y beside it, because those are two different lines rather than one line rearranged.
ResidualResiduals, standardised and studentised residuals, leverage and Cook's distance, with Anscombe's quartet built in — including the dataset every residual rule scores cleanest and which one point controls entirely.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool. A logarithmic fit rises without bound and cannot represent a ceiling or a baseline at x = 0; a fitted per-doubling increment describes the range measured and is an association rather than a causal effect.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (4 updates)

Published 12 September 2026

  1. Published a logarithmic regression that reports what one doubling of x adds to y rather than only the coefficient. On the ad-spend preset every doubling of budget buys the same 91.30 conversions, whether it goes from 100 to 200 or from 5,000 to 10,000 — which is the defining property of the shape and the reason to choose it.
  2. This is the one log-transformed fit on the site whose R-squared needs no caveat: only x is transformed, so ordinary least squares already runs in the original y units. The tool prints the residual sum as visible proof — it is zero here, and provably is not for an exponential or power fit on the original scale.
  3. The decibel preset recovers 20/ln(10) = 8.685890 with an R-squared of exactly 1 from the scale's own definition, and a per-doubling figure of 6.0206 dB, which is the number every audio reference quotes. The tool derived it rather than being told it.
  4. Rows with x at or below zero are excluded and counted, and the page states plainly that shifting x by a constant to dodge that changes every coefficient by an amount depending entirely on the constant chosen.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.