0
$\begingroup$

I ran multiple linear regression in R. I have a skewed Y variable and log transforming it gives better results. I didn't transform any of the x variables. Thus, in order to interpret the coefficients I need to exponentiate the coefficients and once doing that I receive a very high intercept value:

Coefficients

Please find my code below:

ols_log <- lm(log(Inc_sales) ~.-Page_nr, data = train)
summary(ols_log)
rmse_log<-rmse(actual=log(train$Inc_sales), predicted =ols_log$fitted.values)
rmse_log
matrix_coef <- summary(ols_log)$coefficients
ols_log_estimates <- matrix_coef[,1]
ols_log_estimates

#Interpretation of the log coefficients
exp <-(exp(ols_log_estimates)-1)*100
exp <-format(exp, scientific=FALSE)
exp 
table(exp)

exp %>%
  kbl(caption = "Coefficients in %") %>%
  kable_classic(full_width = F, html_font = "Times New Roman")

Do I interpret correctly that for every one-unit increase in x, y increases by about 48000%? How can I have such a high intercept and how could I fix it?

image with summary(log_ols): enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$

I don't use R routinely but if this guess is wrong that will be spotted quickly enough. I guess that log() in R means natural logarithms and your use of exp() as inverse implies that too. So far, so good.

Either way, suppose that you used natural logarithms so that your fitted model gives predictions of the form

$$\ln y = b_0 + b_1 x_1 + b_2 x_2 + \cdots$$

so that you are led to think in terms of getting predictions

$$y = \exp(b_0 + b_1 x_1 + b_2 x_2 + \cdots).$$ However, that is not at all the same as

$$y = \exp(b_0) + \exp(b_1 x_1) + \exp(b_2 x_2) + \cdots$$

as you may be assuming.

$\endgroup$
7
  • $\begingroup$ Thank you for your answer, @Nick! However can you please explain a bit more why it would not be the same? and in that case how I can interpret the intercept? $\endgroup$ Commented Nov 17, 2021 at 13:27
  • 2
    $\begingroup$ For the same reason as that $\exp(p q) = \exp(p) \exp(q)$ not $\exp(p) + \exp(q)$. See any exposition of exponential functions. The intercept $b_0$ is what is predicted for $\ln y$ when the rest of the RHS is zero. Is that even attainable with your data? Can you show summary(ols_log)? $\endgroup$
    – Nick Cox
    Commented Nov 17, 2021 at 13:38
  • $\begingroup$ I am not sure indeed if it is attainable as I have mostly categorical variables. I attached the image of summary(ols_log) at the end of my post. $\endgroup$ Commented Nov 17, 2021 at 14:10
  • $\begingroup$ Suffice it to say that -- as far as I can see -- the intercept has no useful interpretation in your case. $\endgroup$
    – Nick Cox
    Commented Nov 17, 2021 at 14:40
  • $\begingroup$ Thanks so much!! $\endgroup$ Commented Nov 17, 2021 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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