I have a dataset with both quantitative ($x_1,x_2, \text{and} \ x_3$) and qualitative variables ($x_4$ - 4 levels ~0,1,2,3). 3 variables ($x_1,x_2,x_3$) have been log transformed. I do not know how to interpret coefficients when its log transformed.

glm(formula = y ~ log(1 + x1) + log(1 + x2) +                   
      log(1 + x3) + factor(x4), family = "quasipoisson",data = data)

(Intercept)     0.20
log(1 + x1)     0.76
log(1 + x2)     -0.1
log(1 + x3)     0.25
factor(x4)1     0.4
factor(x4)2     0.45
factor(x4)3     0.57

Let's suppose, if I want $x_4$ (for levels 0,1,2,3) to vary $x_1$ from 0,1,2,...,40 how would it effect my response considering everything being equal ? In addition, how to interpret $x_1,x_2, \text{ and } x_3$ ?.

Numerical Example, I want to vary $x_3$ between 0,1,2,3,4,5,... and so on and determine its impact on y for 4 different levels in variable $x_4$:

Let's suppose I want to predict for factor 0 which is when $x_4$ at 0 when $x_3 = 5$:

$$y = exp^{(0.20+0.25*5)}$$

Let's suppose I want to predict for factor 2 which is when $x_4$ at level 1 when x3 = 5:

$$y = exp^{(0.25*5+0.45)}$$

is my interpretation correct ?


Interpreting the coefficient of a log-transformed variables is reasonably straightforward: it represents the predicted change in the dependent variable for a 1-log-unit change in the independent variable.

Here, the dependent variable (in the default log-link for the quasipoisson family in glm) is $log(y)$. After the transformations of the variables $x_1$ through $x_3$, they are no longer the independent variables for the regression. The regression coefficients need to be interpreted in terms of the new independent variables $log(1+x_1)$ through $log(1+x_3)$.

So for the relation of $x_1$ to $y$, with the other independent variables held constant, you have a change of 1 log unit in $(1+x_1)$ corresponding to a change of 0.76 in $log(y)$. That pesky 1 in $log(1+x_1)$ makes is hard to provide a more general direct relation between $x_1$ itself and $y$.

  • $\begingroup$ Thank you @EdM, I have added 1 to x1 to avoid taking log(0) if that makes sense. $\endgroup$ – forecaster Sep 6 '15 at 19:14
  • $\begingroup$ @forecaster : That is what I thought you had done. $\endgroup$ – EdM Sep 6 '15 at 19:18
  • $\begingroup$ Thank you, how would you interpret factors? So for instance how would you determine the impact of x4 at lev ps 0,1,2,3? $\endgroup$ – forecaster Sep 6 '15 at 20:03
  • $\begingroup$ The default in R is for the Intercept to correspond to the reference levels of all categorical factors. The reference level of $x_4$ here is level 0. So as an example, for level 2 of $x_4$, $log(y)$ is 0.45 units higher than it is for level 0 of $x_4$. $\endgroup$ – EdM Sep 6 '15 at 20:27
  • $\begingroup$ Thanks again, I have edited by question with a numerical example, can you please let me know if this correct. I'm confused because this is a log-log regression with qualitative variable. I really appreciate your response. $\endgroup$ – forecaster Sep 6 '15 at 21:34

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.