0
$\begingroup$

Update:

I would like to solve a log-linear equation and interpret the final result. I was noted that my question was not complete/unclear. Fine, now I took a dataset from Kaggle as the example to demo what is my question and what kind of answer I am looking for. This dataset is not the real one that I am dealing with. But I guess the Kaggle's dataset could explain well the same problem:

So if I want to predict Windspeed, I set windspeed as label and Temperature, Humidity, Wind bearing Degrees and Visibility as independent variables. All these variables are numerical data.The below is my result form R:

Call:
lm(formula = log(WindSpeed) ~ Temp + Humidity + WindbearingDegrees + 
    Visibility, data = data)

Residuals:
      Min      1Q  Median      3Q     Max 
   -3.3211 -0.3657  0.1000  0.4272  1.8679 

Coefficients:
                     Estimate Std. Error t value Pr(>|t|)    
(Intercept)         4.193e+00  2.750e-02  152.48   <2e-16 ***
Temp               -1.466e-02  2.819e-04  -52.00   <2e-16 ***
Humidity           -1.141e+00  1.363e-02  -83.72   <2e-16 ***
WindbearingDegrees  8.023e-04  1.897e-05   42.29   <2e-16 ***
Visibility          9.359e-03  5.357e-04   17.47   <2e-16 ***
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6315 on 96448 degrees of freedom
Multiple R-squared:  0.0923,    Adjusted R-squared:  0.09226 
F-statistic:  2452 on 4 and 96448 DF,  p-value: < 2.2e-16

Please don't judge the result e.g. Adjusted R-squared values. This is just a demo. My formula of this problem is:

log(WindSpead)=4.193-1.466e-02*Temp-1.141e*Humidity+8.023e-04*WindbearingDegrees+9.359e-03*Visibility

MY QUESTION-How to solve the equation if I want to "undo" the logarithm step? I know I need to apply the exponential function to the formula. But how? Can anyone show me a step by step calculation? I would highly appreciate if you could also give me an interpretation to the final result e.g. what happens if one independent variable increases by one unit, holding all the other variables fixed.... Thank you!

=====my original question=====

I have got this equation:

 log(Y)=3.17+1.05*X1-1.01*X2

Now if I would like to take the log away from the left side, how should I calculate on the right side? Like this?

 y=exp(3.17+1.05*X1-1.01*X2)
  =exp(3.17)exp(1.05)*X1/exp(1.01)*X2
  =23.81*2.86*X1/2.75*X2

Also if you could give an interpretation based on result, that would be super help. Thank you!

$\endgroup$
  • $\begingroup$ the equation is easier to interpret in the log form precisely because the terms you're trying to understand are linearly related and you can interpret them as you would any other linear regression. $\endgroup$ – emiru Nov 26 '20 at 18:57
  • $\begingroup$ @emiru, thanks for your comment. If I would like to solve the equation, how can I do it? $\endgroup$ – almo Nov 26 '20 at 19:15
  • $\begingroup$ I agree with @almo, it is easiest to interpret the equation in log form. I am not clear why you would want to remove the log, maybe to plot the curves? If so, calculate log(Y) and you can convert to (Y) or plot on a log scale, whatever you want. $\endgroup$ – Mike O'Riordan Nov 26 '20 at 19:16
  • $\begingroup$ You can't solve the equation, iit has 3 unknowns in it. $\endgroup$ – emiru Nov 26 '20 at 19:25
  • $\begingroup$ I don't understand what you're trying to do or why it'd help you to split out the terms? $\endgroup$ – emiru Nov 26 '20 at 19:35
1
+50
$\begingroup$

Based on this result that you found

log(WindSpead)=4.193-1.466e-02*Temp-1.141e*Humidity+8.023e-04*WindbearingDegrees+9.359e-03*Visibility

I will denote the model as

$$log(Wind)=a-b*Temp-c*Hum+d*WindDeg+f*Vis$$

Then in order to make inference for $Wind$ you just take the exponential of the RHS

$$Wind = e^{a-b*Temp-c*Hum+d*WindDeg+f*Vis}$$

If we increase the $Temp$ to $Temp+1$ then the term that will change is

$$e^{a-b*(Temp+1)}=e^{a-b*Temp-b}=e^{a-b*Temp}e^{-b}$$

Because the coefficient $b$ in your case is $1.466e-02$ which is a positive number, then $-b<0$, hence $e^{-b}<1$.

Lastly, the interpretation will be that for a unit increase of $Temp$ the $Wind$ is decreased by $e^{-b}$.

Similar for the rest, for unit increase of $Vis,$ the $Wind$ will increase by $e^{f}$.

$\endgroup$
  • $\begingroup$ Thanks @Fiodor. That's the answer I am looking for. I guess I need to review this exponential function part. When temp increases by one unit, the equation becomes exp(a-btemp)exp(-b), I understand your explanation about exp(-b) part, but what happens to exp(a-bTemp)? Are they ignored? Thank you! $\endgroup$ – almo Nov 30 '20 at 8:10
  • 1
    $\begingroup$ Because exp(a-bTemp) is a common term, that was in the original formulation and the latter one (i.e one unit update), you do not consider it for the inference. You just simply want to find out how the formula it is changed for a unit change of Temp (when the rest variables remain the same). It changes by exp(-b) and the term exp(a-bTemp) is common in both cases so it adds nothing. $\endgroup$ – Fiodor1234 Nov 30 '20 at 9:20
  • $\begingroup$ I see. Thank you @Fiodor1234 :) $\endgroup$ – almo Nov 30 '20 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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