4
$\begingroup$

I'm trying to model a lognormal response variable. I want to take the log of the response variable and do a least-squares regression line over my predictive variable. However, I'm worried about this. Is this an okay thing to do? I know that for my original variable, variance grows with the mean, but would taking logs adjust for this appropriately?

$\endgroup$
  • 1
    $\begingroup$ If the standard deviation is proportional to the mean (ie, constant coefficient of variation) then log transform is fine I think. Try a scatter plot with logarithmic y axis $\endgroup$ – tristan Jun 7 '15 at 7:58
  • $\begingroup$ How do you know your response is lognormal? $\endgroup$ – Glen_b Jun 7 '15 at 9:01
5
$\begingroup$

I would suggest using a generalised linear model (GLM) with a log-link function instead of directly log-transforming your variables; in R you can simply use glm with family= gaussian(link='log') to begin with.

I say this because modelling the mean of the log-transformed variable (as you would do by simply taking the logarithms of your dependent variable) is not always the same as modelling the log of the variable's mean. The user @Corone made a very informative post about this issue here. In short, if the logarithm transformation is not perfectly appropriate it will give suboptimal results in comparison with a GLM.

A very good initial point is the paper by Lindsey & Jones on "Choosing among generalized linear models applied to medical data". (It is easily found online for free if you google/bing the title...)

$\endgroup$
  • 1
    $\begingroup$ glm with family=gaussian(link=log) does not seem appropriate for a lognormally distributed response variable; this models with a family of Gaussians with means = exp(linear predictor). $\endgroup$ – James King Oct 12 '15 at 18:55
  • 1
    $\begingroup$ @JamesKing: I partially agree; one makes the assumption of constant variance when using a Gaussian model. I specifically said "modelling the mean of the log-transformed variable is not always the same as modelling the log of the variable's mean.. $\endgroup$ – usεr11852 Oct 12 '15 at 21:18
  • $\begingroup$ @JamesKing: isn't that what a lognormal distribution is? What would you recommend instead? $\endgroup$ – antoine-sac Nov 13 '18 at 17:16
4
$\begingroup$

I want to take the log of the response variable and do a least-squares regression line over my predictive variable.

If I expected the relationship to be linear on the log scale, that's where I'd probably start.

Is this an okay thing to do?

It can be; it depends on what else is going on.

I know that for my original variable, variance grows with the mean, but would taking logs adjust for this appropriately?

It might, or it might not. It depends on exactly how the variance is related to the mean. If the standard deviation is a constant multiple of the mean (variance proportional to mean squared), then you should end up with constant variance on the log scale. Otherwise you won't.

$\endgroup$
  • $\begingroup$ One point not otherwise mentioned is the tractability of multiplicative, log-log models (both the response and predictor are natural log transforms) and the intuition that, in regression, the coefficient of the predictor amounts to an elasticity (e.g., for a % change (typically 1%) in X, what's the corresponding % change in Y?), which may or may not be a desirable economic quantity. That said, my personal preference is not to do much in the way of transforming response variables in regression because it can open up a can of worms wrt the retransformation bias of the predictions. $\endgroup$ – Mike Hunter Jun 7 '15 at 11:06

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.