In my generalized linear models class we did a natural logarithm transformation to a linear model in order to adjust its "quadratic characteristics" towards more linear ones.

This raised the question, after one's generated the model using logarithmic response (rather than the original response), can one reverse the logarithm in the resulting model to get back to the original scale or is this kind of invertibility destroyed in the model generating process?


If one has a model $$Y \text{ ~ } X_1 + X_2 + \cdot \cdot \cdot$$ and one creates a model $$\hat{\log(Y)}$$ by taking $\log$ of the above response $Y$ and then creating the model, then can one use the resulting $\hat{\log(Y)}$ model to deduce back to $\hat{Y}$, i.e. deduce the model $\hat{Y}$ from model $\hat{\log(Y)}$ only (since in some sense $\hat{\log(Y)}$ has been gotten from $Y$ by taking $\log$, then can one go back by exponentiating?)?

  • $\begingroup$ Your descriptions (at the end) are vague: could you provide a simple example to illustrate what you are trying to describe? $\endgroup$ – whuber Sep 21 '16 at 14:19

Not in general. Here's a quick example in R using the Anderson iris dataset:


# linear model
l1 <- lm(Petal.Length ~ Petal.Width, iris)
# log-linear model
l2 <- lm(log(Petal.Length) ~ Petal.Width, iris)

predict_length <- function(model, x) predict(model, data.frame(Petal.Width = x))

# linear prediction
pred1 <- function(x) predict_length(l1, x)

# exponentiated log-linear prediction
pred2 <- function(x) exp(predict_length(l2, x))

# lognormal "drop-in" estimator
# see: http://davegiles.blogspot.ca/2013/08/forecasting-from-log-linear-regressions.html
sigma2 <- summary(l2)$sigma
pred3 <- function(x) exp(predict_length(l2, x) + 0.5 * sigma2^2)

# compare fitted curves
plot(Petal.Length ~ Petal.Width, iris,
  col = 'darkgray', cex = 0.8,
  xlab = "Petal width", ylab = "Petal length",
  main = "Three fitted curves")
min_x <- min(iris$Petal.Width)
max_x <- max(iris$Petal.Width)
plot(pred1, min_x, max_x, add = TRUE, col = 1)
plot(pred2, min_x, max_x, add = TRUE, col = 2)
plot(pred3, min_x, max_x, add = TRUE, col = 3)
legend('bottomright', legend = c("Linear", "Loglinear naive", "Loglinear drop-in"), col = 1:3, lwd = 1)

3 curves


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.