# Possible to recover regression slope in log-linear model?

Let's assume we have a data set with two variables. Next, we transform both variables by logarithm and build a regression model on it:

x <- c(1:100)
y <- 10*x # Obviously a linear regression will give slope of 10
lm(log2(y)~log2(x)) # Can we use the log-transformation to recover slope of 10?


Can we use the log-transformed model (lm(log2(y)~log2(x))) to recover the original regression slope (10 in this example) without fitting a new model in the original space?

EDIT:

My example obviously has no error and not very realistic. What if I want to assume the errors be normality with mean of 0 and constant variance and homoscedasticity? What if I want to relax the homoscedasticity assumption?

In the case without error this is straightforward:

Let $y = kx$

Then $\log y = \log k + \log x$

So if you take base 2 logs the slope should be $1$ and the intercept should be $\log_{2}(10)$. And that's what happens:

 ab <- lm(log2(y)~log2(x))$coefficients 2^ab[1] (Intercept) 10  When there's error, it's not quite so simple. The first issue is that since the slope of$1$is known, you should specify it rather than estimate it (e.g. ab <- lm(log2(y)~1, offset=log2(x)) The second thing is that the way the error term comes into the model affects the way you should estimate the coefficient. The third thing is that a mean on log scale is not a mean on the untransformed scale, so once you have error you can't just take$2^\hat{\beta_0}\$ and expect it to be unbiased for the original parameter.

--

If there's additive constant-variance error on the original scale then taking logs is the wrong thing to do (even if all your data were positive, it will induce heteroskedasticity in the logs ... and your estimates won't be unbiased); you'll probably want a no-intercept linear regression then.

See these two cases:

They're not the only two possibilities of course!

Not only is there heteroskedasticity if you take logs when you started with equal variance, you have to be careful if you're seeking unbiased estimation.

• What if with errors? – SmallChess Jul 28 '17 at 10:56
• It depends how they enter the model. (The model you fitted is most suitable for a particular subset of situations - specifically where the error is additive and homoskedastic on the log scale.) – Glen_b Jul 28 '17 at 11:04
• I'm very sorry for the delay in response. What if I want to assume the errors be normality with mean of 0 and constant variance and homoscedasticity? How does that affect your answer? What if I relax the homoscedasticity assumption? @Glen_b – SmallChess Aug 7 '17 at 11:27
• I added some detail. If you relax homoscedasticity then it depends on how / what you know/assume – Glen_b Aug 8 '17 at 10:09
• Thanks. I think I should do my modelling in the original scale (where I know the parameters). Journal papers usually prefer equations reported in the log-scale, but I don't think I will do it this case! – SmallChess Aug 8 '17 at 10:37