# In regression analysis what does taking the log of a variable do?

I keep seeing this in class and I don't understand why we add the log in there from time to time. For example we have regression model 1: $$1:\hat Y=-14.37+.321X_1+.043X_2-.0051X_3+.0035X_4$$ and then it says that we reestimate the model using the log form of $X_3$ and $X_4$ to get model 2: $$2:\hat Y=-36.30+.327X_1+.069X_2-4.74\log(X_3)+7.24\log(X_4)$$ what does the $\log$ do? In terms of affecting the regression and in terms of affecting the variables.

• Sometimes people use log to bring a skewed variable to be more normal. Some inferences depend on the assumption of normal distribution. – JACKY Li Oct 21 '12 at 18:35
• @Patrick so you're saying the log will "normalize" a variable? – Kyle Oct 21 '12 at 21:11
• It changes the dependence of $\hat Y$ on $X_3,X_4$. That may be a better reflection of reality. You can also try $X_3^2$, $\exp(X_4)$ or whatever makes a decent fit to your data. – Ross Millikan Oct 21 '12 at 22:15
• @PatrickLi there is no need for the x-variables to be normal – Glen_b Oct 21 '12 at 23:55

## 3 Answers

There are two sorts of reasons for taking the log of a variable in a regression, one statistical, one substantive.

Statistically, OLS regression assumes that the errors, as estimated by the residuals, are normally distributed. When they are positively skewed (long right tail) taking logs can sometimes help. Sometimes logs are taken of the dependent variable, sometimes of one or more independent variables.

Substantively, sometimes the meaning of a change in a variable is more multiplicative than additive. For example, income. If you make \$20,000 a year, a \$5,000 raise is huge. If you make \$200,000 a year, it is small. Taking logs reflects this: log(20,000) = 9.90 log(25,000) = 10.12 log(200,000) = 12.20 log(205,000) = 12.23  The gaps are then 0.22 and 0.03. In terms of interpretation, you are now saying that each change of 1 unit on the log scale has the same effect on the DV, rather than each change of 1 unit on the raw scale. • @Kyle Clarification: The effects of removing skew and turning multiplicative relationships to additive ones only apply when you take logs of the dependent variable - neither effect applies to the specific details of your question, which had logs only on independent variables. However, it's important to know about those effects. – Glen_b Oct 22 '12 at 21:42 Taking logs will make certain forms of relationship that look curved look linear or more nearly linear. Think of introducing new variables,$X_5 = \log(X_3)$and$X_6 = \log(X_4)$and then your model is linear in$X_1, X_2, X_5$and$X_6\$.

Sometimes these transformations are obvious from subject-matter considerations. Sometimes they're just chosen empirically.

This is an old question, but I often found myself looking for this specific interpretation in the past so I will add it here.

Another substantive example is in the field of econometrics, when regression analysis is used to calculate the elasticities (relative percentage change of one variable with respect to another). In this case, the log-log functional form, where both the dependent and independent variables are log-transformed, is very convenient because the coefficients obtained directly give the respective elasticities instead of having to take the partial derivatives. For the mathematical formulation, I refer to @Charlie's answer here Interpretation of log transformed predictor