Skip to content

Linearising exponential and power data

By MathLab · Reviewed

Linearising data means transforming variables so that a proposed nonlinear relationship becomes a straight-line relationship. A straight line is easier to recognise and analyse because its gradient and intercept reveal the parameters of the original model.

The two central results are

y=Abx⟹ln⁡y=xln⁡b+ln⁡A\boxed{y=Ab^x\quad\Longrightarrow\quad \ln y=x\ln b+\ln A}

and

y=Axn⟹ln⁡y=nln⁡x+ln⁡A.\boxed{y=Ax^n\quad\Longrightarrow\quad \ln y=n\ln x+\ln A.}

They look similar, but require different graphs. For an exponential model, plot ln⁡y\ln y against xx. For a power model, plot ln⁡y\ln y against ln⁡x\ln x.

Proposed modelLinear formHorizontal axisVertical axisGradientIntercept
y=mx+cy=mx+cy=mx+cy=mx+cxxyymmcc
y=Abxy=Ab^xln⁡y=(ln⁡b)x+ln⁡A\ln y=(\ln b)x+\ln Axxln⁡y\ln yln⁡b\ln bln⁡A\ln A
y=Aekxy=Ae^{kx}ln⁡y=kx+ln⁡A\ln y=kx+\ln Axxln⁡y\ln ykkln⁡A\ln A
y=Axny=Ax^nln⁡y=nln⁡x+ln⁡A\ln y=n\ln x+\ln Aln⁡x\ln xln⁡y\ln ynnln⁡A\ln A

The phrase plot PP against QQ means put PP on the vertical axis and QQ on the horizontal axis.

The exponential curve y equals 2 to the power x passes through (0,1), (1,2), (2,4), (3,8). Plotting natural log y against x gives a straight line through the origin with gradient natural log 2.

The same four observations appear on both graphs. Transforming the vertical coordinate changes the curve into a line; it does not change the original measurements.

You should be able to:

A straight line has the form

Y=mX+c,Y=mX+c,

where XX is the horizontal variable, YY is the vertical variable, mm is the gradient and cc is the vertical intercept.

Linearisation does not claim that the original graph of yy against xx is straight. It defines transformed variables XX and YY so that the transformed equation has the form Y=mX+cY=mX+c.

The comparison with Y=mX+cY=mX+c should always be explicit. It prevents the most common error: reading the correct gradient from the wrong axes.

Suppose

y=Abx,y=Ab^x,

where A>0A>0, b>0b>0 and b≠1b\ne1. Taking natural logarithms gives

ln⁡y=ln⁡(Abx)=ln⁡A+ln⁡(bx)=ln⁡A+xln⁡b.\begin{aligned} \ln y&=\ln(Ab^x)\\ &=\ln A+\ln(b^x)\\ &=\ln A+x\ln b. \end{aligned}

Rearrange this as

ln⁡y⏟Y=ln⁡b⏟mx⏟X+ln⁡A⏟c.\underbrace{\ln y}_{Y} =\underbrace{\ln b}_{m}\underbrace{x}_{X} +\underbrace{\ln A}_{c}.

Therefore a plot of ln⁡y\ln y on the vertical axis against xx on the horizontal axis should be a straight line with

m=ln⁡b,c=ln⁡A.m=\ln b, \qquad c=\ln A.

Recover the original parameters by undoing the logarithms:

b=em,A=ec.\boxed{b=e^m,\qquad A=e^c.}

If the original model is written as y=Aekxy=Ae^{kx}, then

ln⁡y=kx+ln⁡A,\ln y=kx+\ln A,

so the gradient is directly kk.

The variables xx and yy are believed to satisfy

y=7(1.4)x.y=7(1.4)^x.

Find the equation of the straight line obtained by plotting ln⁡y\ln y against xx.

Take natural logarithms:

ln⁡y=ln⁡7+xln⁡1.4.\ln y=\ln 7+x\ln 1.4.

Hence the straight-line equation is

ln⁡y=0.33647…x+1.94591….\ln y=0.33647\ldots x+1.94591\ldots.

The gradient is positive because 1.4>11.4>1, so the original model represents growth.

Worked example 2: recover an exponential model

Section titled “Worked example 2: recover an exponential model”

A plot of ln⁡y\ln y against xx produces the line

ln⁡y=1.7−0.24x.\ln y=1.7-0.24x.

Write the relationship between xx and yy in the forms y=Aekxy=Ae^{kx} and y=Abxy=Ab^x.

Exponentiate both sides:

y=e1.7−0.24x=e1.7e−0.24x.\begin{aligned} y&=e^{1.7-0.24x}\\ &=e^{1.7}e^{-0.24x}. \end{aligned}

Therefore

y=5.4739…e−0.24x,y=5.4739\ldots e^{-0.24x},

so, to three significant figures,

y=5.47e−0.24x.\boxed{y=5.47e^{-0.24x}.}

For the form y=Abxy=Ab^x,

b=e−0.24=0.7866…,b=e^{-0.24}=0.7866\ldots,

giving

y=5.47(0.787)x.\boxed{y=5.47(0.787)^x.}

The negative gradient means 0<b<10<b<1, which is consistent with exponential decay.

Worked example 3: linearise a table of data

Section titled “Worked example 3: linearise a table of data”

The following measurements are believed to follow y=Aekxy=Ae^{kx}.

xx00224466
yy3.003.004.484.486.686.689.969.96

Add a row of transformed values, keeping enough decimal places for the calculation:

xx00224466
ln⁡y\ln y1.0991.0991.4991.4991.8991.8992.2992.299

The increments in ln⁡y\ln y are approximately constant for equal increments in xx, so a plot of ln⁡y\ln y against xx is approximately linear.

Using the first and last transformed points,

m≈2.299−1.0996−0=0.200.m\approx\frac{2.299-1.099}{6-0}=0.200.

The intercept is approximately 1.0991.099, so

k≈0.200,A≈e1.099=3.00.k\approx0.200, \qquad A\approx e^{1.099}=3.00.

The model is therefore

y≈3.00e0.200x.\boxed{y\approx3.00e^{0.200x}.}

With real data, use all the transformed points in a linear regression rather than estimating from two arbitrarily chosen data points.

Suppose

y=Axn,y=Ax^n,

where A>0A>0 and, for logarithms, x>0x>0 and y>0y>0. Taking natural logarithms gives

ln⁡y=ln⁡(Axn)=ln⁡A+nln⁡x.\begin{aligned} \ln y&=\ln(Ax^n)\\ &=\ln A+n\ln x. \end{aligned}

Now compare with Y=mX+cY=mX+c:

ln⁡y⏟Y=n⏟mln⁡x⏟X+ln⁡A⏟c.\underbrace{\ln y}_{Y} =\underbrace{n}_{m}\underbrace{\ln x}_{X} +\underbrace{\ln A}_{c}.

Therefore a plot of ln⁡y\ln y against ln⁡x\ln x should be a straight line with

n=m,A=ec.\boxed{n=m,\qquad A=e^c.}

The gradient is the power itself. This is the key distinction from an exponential model.

A plot of ln⁡y\ln y against ln⁡x\ln x has gradient 1.61.6 and vertical intercept −0.7-0.7. Find the model y=Axny=Ax^n.

Since the gradient equals nn,

n=1.6.n=1.6.

Since the intercept equals ln⁡A\ln A,

ln⁡A=−0.7\ln A=-0.7

and therefore

A=e−0.7=0.496585….A=e^{-0.7}=0.496585\ldots.

Thus

y≈0.497x1.6.\boxed{y\approx0.497x^{1.6}.}

Do not set A=−0.7A=-0.7. The intercept is ln⁡A\ln A, not AA.

Worked example 5: use two transformed points

Section titled “Worked example 5: use two transformed points”

Variables xx and yy satisfy y=Axny=Ax^n. On a graph of log⁡10y\log_{10}y against log⁡10x\log_{10}x, the straight line passes through (0,0.4)(0,0.4) and (2,3.0)(2,3.0). Find AA and nn.

The gradient is

n=3.0−0.42−0=1.3.n=\frac{3.0-0.4}{2-0}=1.3.

The intercept is

log⁡10A=0.4,\log_{10}A=0.4,

so

A=100.4=2.5118….A=10^{0.4}=2.5118\ldots.

Therefore

y≈2.51x1.3.\boxed{y\approx2.51x^{1.3}.}

This example uses base 1010 rather than base ee. The method is unchanged, but the inverse operation must match the logarithm used: A=10cA=10^c for common logarithms and A=ecA=e^c for natural logarithms.

For a particular material, breaking load FF is modelled by F=AdnF=Ad^n, where dd is diameter. A log-log regression gives

ln⁡F=2.08ln⁡d+3.15.\ln F=2.08\ln d+3.15.

Find the model and estimate FF when d=4.5d=4.5.

Comparing with

ln⁡F=nln⁡d+ln⁡A,\ln F=n\ln d+\ln A,

gives

n=2.08,A=e3.15=23.336….n=2.08, \qquad A=e^{3.15}=23.336\ldots.

Hence

F≈23.336d2.08.F\approx23.336d^{2.08}.

At d=4.5d=4.5,

F≈23.336(4.5)2.08=533.7….F\approx23.336(4.5)^{2.08}=533.7\ldots.

Therefore

F≈534\boxed{F\approx534}

in the stated units. Use the unrounded values of AA and nn in the final calculation if they are available.

If both an exponential and a power model seem plausible:

  1. plot ln⁡y\ln y against xx to test an exponential model;
  2. plot ln⁡y\ln y against ln⁡x\ln x to test a power model;
  3. compare the patterns of residuals and the strength of the linear fits;
  4. use the context and mechanism, not correlation alone, to select a model.

A high correlation coefficient for transformed data supports linearity over the observed range. It does not prove that the proposed law is true for all values.

For transformed data, enter the appropriate transformed variables into two calculator lists and perform linear regression in the form

Y=a+bX.Y=a+bX.

Calculator letters vary, so translate the output by meaning:

  • bb is the gradient;
  • aa is the vertical intercept;
  • the original parameters follow from the comparison table above.

Record more digits than the final answer requires. Premature rounding of logarithms, gradients or intercepts can noticeably change the recovered model.

If a question asks you to draw a line of best fit by hand, choose two well-separated points on the line, not necessarily two measured data points. Then calculate

m=Y2−Y1X2−X1.m=\frac{Y_2-Y_1}{X_2-X_1}.

Widely separated points reduce the effect of reading error.

To calculate ln⁡x\ln x and ln⁡y\ln y as real numbers, both xx and yy must be positive. Zero and negative observations cannot simply be included in a logarithmic transformation.

This does not automatically mean the underlying situation is impossible. It means that this particular transformation and model need reconsideration. A shifted model such as y=C+Abxy=C+Ab^x does not become linear merely by plotting ln⁡y\ln y against xx because

ln⁡(C+Abx)≠ln⁡C+ln⁡(Abx).\ln(C+Ab^x)\ne \ln C+\ln(Ab^x).

Strictly, a logarithm acts on a dimensionless ratio. In a data analysis, writing ln⁡x\ln x is shorthand for logging the numerical value of xx in fixed stated units, or for ln⁡(x/x0)\ln(x/x_0) using a reference value x0x_0.

Changing units can alter the intercept, and sometimes the numerical value of AA, but it does not alter the essential fitted relationship when conversions are handled consistently. Always state the units of the original variables and use one unit system throughout.

Transformation changes the error structure

Section titled “Transformation changes the error structure”

Least-squares regression on ln⁡y\ln y minimises vertical discrepancies in ln⁡y\ln y, not in yy. It is therefore especially natural when errors are proportional or multiplicative. A good transformed fit should still be checked against the original data and context.

An estimate within the observed range is an interpolation. An estimate beyond it is an extrapolation and is less reliable. Linear appearance after transformation does not justify extreme predictions.

”Taking logs makes any curve straight”

Section titled “”Taking logs makes any curve straight””

No. It makes particular model families straight. If the proposed model is unsuitable, the transformed points will still show curvature or another systematic pattern.

”The gradient of ln⁡y\ln y against xx is the base”

Section titled “”The gradient of ln⁡y\ln ylny against xxx is the base””

For y=Abxy=Ab^x, the gradient is ln⁡b\ln b, so b=emb=e^m. The gradient is directly the exponent coefficient only when the model is written y=Aekxy=Ae^{kx}.

”A power model needs only the yy values logged”

Section titled “”A power model needs only the yyy values logged””

For y=Axny=Ax^n, both variables must be logged:

ln⁡y=nln⁡x+ln⁡A.\ln y=n\ln x+\ln A.

Plotting ln⁡y\ln y against xx tests an exponential model instead.

For both principal transformations, the intercept is ln⁡A\ln A. Exponentiate it to recover AA.

”The base of the logarithm changes the power”

Section titled “”The base of the logarithm changes the power””

It does not. For a power model, the gradient is nn with any consistent logarithm base. Only the interpretation of the intercept changes from A=ecA=e^c to A=10cA=10^c, for example.

Which graph should be linear if y=6(0.8)xy=6(0.8)^x?

Answer

Plot ln⁡y\ln y vertically against xx horizontally. The line has gradient ln⁡0.8<0\ln 0.8<0 and intercept ln⁡6\ln 6.

A plot of ln⁡y\ln y against xx has gradient 0.350.35 and intercept 1.21.2. Find the model in the form y=Aekxy=Ae^{kx}.

Answer k=0.35,A=e1.2=3.3201….k=0.35, \qquad A=e^{1.2}=3.3201\ldots.

Therefore

y≈3.32e0.35x.y\approx3.32e^{0.35x}.

A plot of log⁡10y\log_{10}y against log⁡10x\log_{10}x has equation

log⁡10y=2.4log⁡10x−0.3.\log_{10}y=2.4\log_{10}x-0.3.

Find AA and nn in y=Axny=Ax^n.

Answer

The gradient gives n=2.4n=2.4. The intercept gives

log⁡10A=−0.3,\log_{10}A=-0.3,

so

A=10−0.3=0.5012….A=10^{-0.3}=0.5012\ldots.

Thus y≈0.501x2.4y\approx0.501x^{2.4}.

A student linearises y=Axny=Ax^n and writes ln⁡y=nln⁡x+A\ln y=n\ln x+A. What has gone wrong?

Answer

They have treated ln⁡A\ln A as AA. The correct transformation is

ln⁡y=nln⁡x+ln⁡A.\ln y=n\ln x+\ln A.

The correlation coefficient between xx and ln⁡y\ln y is −0.998-0.998. What does this suggest, and what does it not prove?

Answer

It suggests that an exponential decay model may fit the observed range very well because ln⁡y\ln y is strongly and negatively linearly related to xx. It does not prove causation, establish the mechanism, or guarantee reliable extrapolation outside the data range.

Before finishing a linearisation question, check that you have:

  • taken logarithms of the complete model;
  • expanded them using the log laws correctly;
  • identified the transformed XX and YY variables;
  • compared the equation explicitly with Y=mX+cY=mX+c;
  • interpreted the gradient and intercept for the stated model;
  • undone the logarithm using the matching base;
  • kept unrounded calculator values until the final answer;
  • stated the final model in the requested form;
  • commented on fit and extrapolation only as strongly as the evidence allows.