Mathwords logoMathwords

Logarithmic Regression — Definition, Formula & Examples

Logarithmic regression is a way to fit a curve to data that changes quickly at first and then levels off. You replace x with ln x and fit a straight line to the transformed data.

Logarithmic regression is the least-squares fit of the model y^=a+bln⁡x\hat{y} = a + b\ln x for x>0x > 0. It is equivalent to the least-squares regression line of yy on the transformed explanatory variable ln⁡x\ln x. The constants aa and bb minimize ∑(yi−a−bln⁡xi)2\sum (y_i - a - b\ln x_i)^2.

Key Formula

y^=a+bln⁡x,x>0\hat{y} = a + b\ln x, \quad x > 0
Where:
  • y^\hat{y} = predicted value of the response variable
  • aa = predicted y when x = 1, because ln 1 = 0
  • bb = change in predicted y for each 1-unit increase in ln x
  • xx = explanatory variable (must be positive)
  • ln⁡x\ln x = natural logarithm of x

How It Works

First, check that the scatterplot shows a curve that is steep on the left and flattens out as x grows. Next, create a new variable ln⁡x\ln x (every x-value must be positive). Then run ordinary least-squares regression of yy on ln⁡x\ln x. Calculators such as the TI-84 do this directly with LnReg. If the residual plot against ln⁡x\ln x shows no pattern, the model fits well. To interpret the slope, note that doubling x always adds bln⁡2≈0.693bb\ln 2 \approx 0.693b to the predicted y, wherever you start.

Worked Example

Problem: A teacher fits a logarithmic regression to hours studied (x) and test score (y). The model is y^=50+10ln⁡x\hat{y} = 50 + 10\ln x. A student studied 4 hours and scored 66. Find the predicted score and the residual.
Step 1: Take the natural log of x = 4.
ln⁡4≈1.386\ln 4 \approx 1.386
Step 2: Substitute into the model to get the predicted score.
y^=50+10(1.386)≈63.86\hat{y} = 50 + 10(1.386) \approx 63.86
Step 3: Find the residual as actual minus predicted.
66−63.86=2.1466 - 63.86 = 2.14
Answer: The predicted score is about 63.86. The residual is about 2.14, so the student scored 2.14 points higher than the model predicts.

Why It Matters

On the AP Statistics exam, you are expected to straighten curved data by transforming a variable and then judge the fit with a residual plot. Logarithmic models describe diminishing returns, such as learning curves, how crop yield responds to fertilizer, and how perceived loudness grows with sound intensity.

Common Mistakes

Mistake: Interpreting b as the change in predicted y when x increases by 1.
Correction: The slope b is the change in predicted y when ln x increases by 1. That happens when x is multiplied by e (about 2.718). It does not happen when x goes up by 1. A clearer statement is that doubling x adds about 0.693b to the prediction.

Related Terms