Skip to main content

Logarithmic regression calculator

A logarithmic model rises quickly at first and then more and more slowly, without levelling off. Fit it with one line, and check it on a log x-axis.

The free IB Math Revision Grapher: y = a ln x + b fitted to practice data: typing speed against days of practice
y = a ln x + b fitted to practice data: typing speed against days of practice. Open it in the full Grapher.

How to do it

  1. Enter your data. Paste or type the table. Every x must be positive, because ln x is only defined for x > 0.
  2. Type the model. Type y_1 ~ a ln(x_1) + b. The model is linear in a and b, so the fit is exact least squares, the same as a GDC's LnReg.
  3. Interpret a and b. b is the value of y when x = 1 (ln 1 = 0), and a is the increase in y each time x is multiplied by e (about 2.72). What this model means words this for your axis labels.
  4. Check on a log x-axis. In Settings, turn on the log scale for x (or use Linearise it in the model's panel). If the model fits, the points lie close to a straight line.
Typing speed data on a logarithmic x-axis in the Grapher, lying close to a straight line, with y = a ln x + b fitted
On a log x-axis, data that follow y = a ln x + b lie on a straight line.

Good to know

Frequently asked questions

Is this the same as my GDC's LnReg?

Yes. y = a ln x + b is linear in a and b, so the Grapher and a GDC both solve it exactly by least squares and give the same a, b and R².

What if some of my x values are 0 or negative?

ln x is only defined for x > 0, so a logarithmic model cannot use those points. If zero means something in your context, think about measuring x differently (for example counting days from 1), and say so in your write-up.

How do I know a log model is right?

Look at the residual plot and at the data on a log x-axis: a log model gives a straight line there and residuals with no pattern. Then ask whether a model that never levels off makes sense in your context.

Learn more

More Grapher guides

The Grapher is our own free tool (graph.mathrevision.co.uk), built for IB, A Level and IGCSE students. It is not an exam calculator: practise on your own GDC for calculator papers.