# Log-log plot

{{ safesubst:#invoke:Unsubst||$N=Refimprove |date=__DATE__ |$B= {{#invoke:Message box|ambox}} }}

A log-log plot of y = x (blue), y = x2 (green), and y = x3 (red).
Note the logarithmic scale markings on each of the axes, and that the log x and log y axes (where the logarithms are 0) are where x and y themselves are 1.

In science and engineering, a log-log graph or log-log plot is a two-dimensional graph of numerical data that uses logarithmic scales on both the horizontal and vertical axes. Monomials – relationships of the form ${\displaystyle y=ax^{k}}$ – appear as straight lines in a log-log graph, with the power and constant term corresponding to slope and intercept of the line, and thus these graphs are very useful for recognizing these relationships and estimating parameters. Any base can be used for the logarithm, though most common are 10, e, and 2.

## Relation with monomials

Given a monomial equation ${\displaystyle y=ax^{k},}$ taking the logarithm of the equation (with any base) yields:

${\displaystyle (\log y)=k(\log x)+\log a.}$

Setting ${\displaystyle X=\log x}$ and ${\displaystyle Y=\log y,}$ which corresponds to using a log-log graph, yields the equation:

${\displaystyle Y=mX+b}$

where m = k is the slope of the line (gradient) and b = log a is the intercept on the (log y)-axis, meaning where log x = 0, so, reversing the logs, a is the y value corresponding to x = 1.[1]

## Equations

The equation for a line on a log-log scale would be:

${\displaystyle \log _{10}(F(x))=m\log _{10}(x)+b,}$
${\displaystyle F(x)=(x^{m})(b),}$

where m is the slope and b is the intercept point on the log plot.

### Slope of a log-log plot

Finding the slope of a log-log plot using ratios

To find the slope of the plot, two points are selected on the x-axis, say x1 and x2. Using the above equation:

${\displaystyle \log[F(x_{1})]=m\log(x_{1})+b,\,}$

and

${\displaystyle {\mathrm {log} }[F(x_{2})]=m\log(x_{2})+b.\,}$

The slope m is found taking the difference:

${\displaystyle m={\frac {{\mathrm {log} }(F_{2})-{\mathrm {log} }(F_{1})}{\log(x_{2})-\log(x_{1})}}={\frac {\log(F_{2}/F_{1})}{\log(x_{2}/x_{1})}},\,}$

where F1 is shorthand for F ( x1 ) and F2 is shorthand for F ( x2 ). The figure at right illustrates the formula. Notice that the slope in the example of the figure is negative. The formula also provides a negative slope, as can be seen from the following property of the logarithm:

${\displaystyle \log(x_{1}/x_{2})=-\log(x_{2}/x_{1}).\,}$

### Finding the function from the log-log plot

The above procedure now is reversed to find the form of the function F(x) using its (assumed) known log-log plot. To find the function F, pick some fixed point (x0, F0), where F0 is shorthand for F(x0), somewhere on the straight line in the above graph, and further some other arbitrary point (x1, F1) on the same graph. Then from the slope formula above:

${\displaystyle m={\frac {\log(F_{1}/F_{0})}{\log(x_{1}/x_{0})}}}$

${\displaystyle \log(F_{1}/F_{0})=m\log(x_{1}/x_{0})=\log[(x_{1}/x_{0})^{m}].\,}$

Notice that 10log10(F1) = F1. Therefore, the logs can be inverted to find:

${\displaystyle {\frac {F_{1}}{F_{0}}}=\left({\frac {x_{1}}{x_{0}}}\right)^{m}}$

or

${\displaystyle F_{1}={\frac {F_{0}}{x_{0}^{m}}}\,\,x^{m},\,}$

which means that

${\displaystyle F(x)={\mathrm {constant} }\cdot x^{m}.}$

In other words, F is proportional to x to the power of the slope of the straight line of its log-log graph. Specifically, a straight line on a log-log plot containing points (F0x0) and (F1x1) will have the function:

${\displaystyle F(x)={F_{0}}\left({\frac {x}{x_{0}}}\right)^{\frac {\log(F_{1}/F_{0})}{\log(x_{1}/x_{0})}},}$

Of course, the inverse is true too: any function of the form

${\displaystyle F(x)={\mathrm {constant} }\cdot x^{m}}$

will have a straight line as its log-log graph representation, where the slope of the line is m.

### Finding the area under a straight-line segment of log-log plot

To calculate the area under a continuous, straight-line segment of a log-log plot (or estimating an area of an almost-straight-line), take the function defined previously

${\displaystyle F(x)={\mathrm {constant} }\cdot x^{m}.}$

and integrate it. Since it's only operating on a definite integral (two defined endpoints), the area A under the plot takes the form

${\displaystyle A(x)=\int _{x_{0}}^{x_{1}}F(x)={\frac {\mathrm {constant} }{m+1}}\cdot x^{m+1}:[x_{0},x_{1}]}$

Rearranging the original equation and plugging in the fixed point values, it is found that

${\displaystyle \mathrm {constant} ={\frac {F_{0}}{x_{0}^{m}}}}$

Substituting back into the integral, you find that for A over x0 to x1

${\displaystyle A={\frac {F_{0}/x_{0}^{m}}{m+1}}\cdot (x_{1}^{m+1}-x_{0}^{m+1})}$
${\displaystyle \log A=\log \left[{\frac {F_{0}/x_{0}^{m}}{m+1}}\cdot (x_{1}^{m+1}-x_{0}^{m+1})\right]=\log {\frac {F_{0}}{m+1}}-\log {\frac {1}{x_{0}^{m}}}+\log(x_{1}^{m+1}-x_{0}^{m+1})}$
${\displaystyle \log A=\log {\frac {F_{0}}{m+1}}+\log \left({\frac {x_{1}^{m+1}-x_{0}^{m+1}}{x_{0}^{m}}}\right)=\log {\frac {F_{0}}{m+1}}+\log \left({\frac {x_{1}^{m}}{x_{0}^{m}}}\cdot x_{1}-{\frac {x_{0}^{m+1}}{x_{0}^{m}}}\right)}$

## Applications

These graphs are useful when the parameters a and b need to be estimated from numerical data. Specifications such as this are used frequently in economics.

One example is the estimation of money demand functions based on inventory theory, in which it can be assumed that money demand at time t is given by

${\displaystyle M_{t}=AR_{t}^{b}Y_{t}^{c}U_{t},}$

where M is the real quantity of money held by the public, R is the rate of return on an alternative, higher yielding asset in excess of that on money, Y is the public's real income, U is an error term assumed to be lognormally distributed, A is a scale parameter to be estimated, and b and c are elasticity parameters to be estimated. Taking logs yields

${\displaystyle m_{t}=a+br_{t}+cy_{t}+u_{t},}$

where m = log M, a = log A, r = log R, y = log Y, and u = log U with u being normally distributed. This equation can be estimated using ordinary least squares.

Another economic example is the estimation of a firm's Cobb-Douglas production function, which is the right side of the equation

${\displaystyle Q_{t}=AN_{t}^{\alpha }K_{t}^{\beta }U_{t},}$

in which Q is the quantity of output that can be produced per month, N is the number of hours of labor employed in production per month, K is the number of hours of physical capital utilized per month, U is an error term assumed to be lognormally distributed, and A, ${\displaystyle \alpha }$, and ${\displaystyle \beta }$ are parameters to be estimated. Taking logs gives the linear regression equation

${\displaystyle q_{t}=a+\alpha n_{t}+\beta k_{t}+u_{t}}$

where q = log Q, a=log A, n=log N, k=log K, and u=log U.

Log-log regression can also be used to estimate the fractal dimension of a naturally occurring fractal.

However, going in the other direction – observing that data appears as an approximate line on a log-log scale and concluding that the data follows a power law – is invalid.[2]

In fact, many other functional forms appear approximately linear on the log-log scale, and simply evaluating the goodness of fit of a linear regression on logged data using the coefficient of determination (R2) may be invalid, as the assumptions of the linear regression model, such as Gaussian error, may not be satisfied; in addition, tests of fit of the log-log form may exhibit low statistical power, as these tests may have low likelihood of rejecting power laws in the presence of other true functional forms. While simple log-log plots may be instructive in detecting possible power laws, and have been used dating back to Pareto in the 1890s, validation as a power laws requires more sophisticated statistics.[2]

These graphs are also extremely useful when data are gathered by varying the control variable along an exponential function, in which case the control variable x is more naturally represented on a log scale, so that the data points are evenly spaced, rather than compressed at the low end. The output variable y can either be represented linearly, yielding a lin-log graph (log x, y), or its logarithm can also be taken, yielding the log-log graph (log x, log y).

## References

1. M. Bourne Graphs on Logarithmic and Semi-Logarithmic Paper (www.intmath.com)
2. {{#invoke:Citation/CS1|citation |CitationClass=journal }}