43
$\begingroup$

Can somebody explain how the properties of logs make it so you can do log linear regressions where the coefficients are interpreted as percentage changes?

$\endgroup$
  • 9
    $\begingroup$ $log(y_t) -log(y_{t-1})=log(y_t/y_{t-1})$, and $y_t/y_{t-1}$ is 1 plus the percentage change. $\endgroup$ – user83346 Nov 4 '16 at 15:22
  • $\begingroup$ Differentiating the equation relative to X1 I think puts us on track in answering the question better than does considering series expressions. $\endgroup$ – Charles Mar 1 '18 at 20:35
45
$\begingroup$

For $x_2$ and $x_1$ close to each other, the percent change $\frac{x_2-x_1}{x_1}$ approximates the log difference $\log x_2 - \log x_1$.

Why does the percent change approximate the log difference?

An idea from calculus is that you can approximate a smooth function with a line. The linear approximation is simply the first two terms of a Taylor Series. The first order Taylor Expansion of $\log(x)$ around $x=1$ is given by:

$$ \log(x) \approx \log(1) + \frac{d}{dx} \left. \log (x) \right|_{x=1} \left( x - 1 \right)$$ The right hand side simplifies to $0 + \frac{1}{1}\left( x - 1\right)$ hence: $$ \log(x) \approx x-1$$

So for $x$ in the neighborhood of 1, we can approximate $\log(x)$ with the line $y = x - 1$ Below is a graph of $y = \log(x)$ and $y = x - 1$.

Example: $\log(1.02) = .0198 \approx 1.02 - 1$.

Now consider two variables $x_2$ and $x_1$ such that $\frac{x_2}{x_1} \approx 1$. Then the log difference is approximately the percent change $\frac{x_2}{x_1} - 1 = \frac{x_2 - x_1}{x_1}$:

$$ \log x_2 - \log x_1 = \log\left( \frac{x_2}{x_1} \right) \approx \frac{x_2}{x_1} - 1 $$

The percent change is a linear approximation of the log difference!

Why log differences?

Often times when you're thinking in terms of compounding percent changes, the mathematically cleaner concept is to think in terms of log differences. When you're repeatedly multiplying terms together, it's often more convenient to work in logs and instead add terms together.

Let's say our wealth at time $T$ is given by: $$ W_T = \prod_{t=1}^T (1 + R_t)$$ Then it might be more convenient to write: $$ \log W_T = \sum_{t=1}^T r_t $$ where $r_t = \log (1 + R_t) = \log W_t - \log W_{t-1}$.

Where are percent changes and the log difference NOT the same?

For big percent changes, the log difference is not the same thing as the percent change because approximating the curve $y = \log(x)$ with the line $y = x - 1$ gets worse and worse the further you get from $x=1$. For example:

$$ \log\left(1.6 \right) - \log(1) = .47 \neq 1.6 - 1$$

What's the log difference in this case?

One way to think about it is that a difference in logs of .47 is equivalent to an accumulation of 47 different .01 log differences, which is approximately 47 1% changes all compounded together.

\begin{align*} \log(1.6) - \log(1) &= 47 \left( .01 \right) \\ & \approx 47 \left( \log(1.01) \right) \end{align*}

Then exponentiate both sides to get: $$ 1.6 \approx 1.01 ^{47}$$

A log difference of .47 is approximately equivalent to 47 different 1% increases compounded, or even better, 470 different .1% increases all compounded etc...

Several of the answers here make this idea more explicit.

$\endgroup$
  • $\begingroup$ +1, in the hopes the planned continuation of this answer will discuss conditions where the approximation breaks down. $\endgroup$ – whuber Nov 4 '16 at 17:43
  • 4
    $\begingroup$ +1. To add a minor point, 1.6 to 1 is a 37.5% decrease, 1 to 1.6 is a 60% increase, the log difference 0.47 is independent of the direction of change, and always in between of 0.375 and 0.6. When we don't know or don't care about the direction of change, log difference could be an alternative of taking averages of the two percent changes, even when the percent change is large. $\endgroup$ – Paul Nov 4 '16 at 18:35
9
$\begingroup$

Here's a version for dummies...

We have the model $Y= \beta_o+\beta_1X+\varepsilon$ - a simple straight line through the data cloud - and we know that once we estimate the coefficients, a $1\text{-unit}$ increase in the prior value of $X=x_1$ will result in a increase of $\hat \beta_1$ in the value of $Y$, from $Y=y_1$, as $\hat\beta_1(x_1+1) -\hat\beta_1x_1= \hat\beta_1$. But the units can actually be meaningless in absolute values.

So we can, instead change the model to $\ln(Y)= \delta_o+\delta_1X+\varepsilon$ (brand new coefficients). Now for the same unit increase in $\hat\delta_1$, we have a change

$$\ln(y_2)-\ln(y_1)=\ln\left(\frac{y_2}{y_1}\right)=\hat\delta_1(x_1+1) -\hat\delta_1x_1= \hat\delta_1 \tag{*}$$

To see the implications for the change in percentage, we can exponentiate $(*)$:

$$\exp(\hat\delta_1)=\frac{y_2}{y_1}=\frac{\color{blue}{y_1}+y_2\color{blue}{-y_1}}{y_1}= 1+\frac{y_2-y_1}{y_1}\tag{**}$$

$\frac{y_2-y_1}{y_1}$ is the relative change, and from $(**)$, $\small 100\,\frac{y_2-y_1}{y_1}=100(\exp(\hat\delta_1)-1)$ the percentage change.

The key to answer the question is to see that $\exp(\hat\delta_1)-1=\hat\delta_1$ for small values of $\hat\delta_1$, which amounts to the same use of the first two terms of the Taylor expansion that Matthew used, but this time of $e^x$ (Maclaurin series) evaluated at zero because we are working with exponents, as opposed to logarithms:

$$e^x=1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots$$

or with $\delta_1$ as the $x$ variable:

$$\exp(\hat\delta_1)=1+\hat\delta_1$$

so $\hat\delta_1=\exp(\hat\delta_1)-1$ around zero (we evaluated the polynomial expansion at zero when we did the Taylor series). Visually,

enter image description here

$\endgroup$
  • $\begingroup$ your answer is quite clear: we need small coefficients to be able to interpret the log-difference as percentage change, but @aksakal 's answer shows that we only need small changes (i.e. lim Δx --> 0). Can you please explain how the two are equivalent? $\endgroup$ – towi_parallelism Oct 20 at 0:23
7
$\begingroup$

Say you have a model $$\ln y = A+B x$$ Take a derivative of a log: $$\frac{d}{dx}\ln y\equiv\frac{1}{y}\frac{dy}{dx}=B$$

Now you can see that the slope $b$ is now a slope of the relative change of $y$: $$\frac{dy}{y}=B dx$$

If you didn't have the log transform then you'd get a slope of absolute change of $y$: $$dy=B dx$$

I didn't replace $dx,dy$ with $\Delta x,\Delta y$ to emphasize that this works for small changes.

$\endgroup$
4
$\begingroup$

There are many great explanations in the present answers, but here is another one framed in terms of financial analysis of the accrual of interest on an initial investment. Suppose you have an initial amount of one unit that accrues interest at (nominal) rate $r$ per annum, with interest "compounded" over $n$ periods in the year. At the end of one year, the value of that initial investment of one unit is:

$$I(n) = \Big( 1+\frac{r}{n} \Big)^n.$$

The more often this interest is "compounded" the more money you get on your initial investment (since compounding means you are getting interest on your interest). Taking the limit as $n \rightarrow \infty$ we get "continuously compounding interest", which gives:

$$I(\infty) = \lim_{n \rightarrow \infty} \Big( 1+\frac{r}{n} \Big)^n = \exp(r).$$

Taking logarithms of both sides gives $r = \ln I(\infty)$, which means that the logarithm of the ratio of the final investment to the initial investment is the continuously compounding interest rate. From this result, we see that logarithmic differences in time-series outcomes can be interpreted as continuously compounding rates of change. (This interpretation is also justified by the answer by aksakal, but the present working gives you another way to look at it.)


$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.