How to back-transform a log transformed regression model in R with bias correction I have created a model to predict the number of people with a certain characteristic (Y) based on predictor variables $X_1$, $X_2$, $X_3$, $X_4$. The model is a multiple linear regression and both the predictors and the outcome variable have been log transformed, that is my equation looks like:
$ln(Y)=a +b*ln(X1)+c*ln(X2)+...$
The aim of the model is to then be applied to a dataset for which we have $X_1,X_2,X_3,X_4$ but need to predict Y (in it's original form). Therefore, I need to backtransform the outputs for Y from the model. I understand that a simple reversal of $e^{ln{Y}}$ isn't appropriate as this does not take into account the error terms within the model, and so including a correction for this is necessary. 
I have tried a correction term of the form $exp{0.5*variance}$ as per Miller's bias correction using the below code but this gives me wildly unlikely outputs and so I have assumed is not correct:
exp((summary(model)$sigma)**2)*exp(data$model.prediction)

where 


*

*data is the dataset used

*model.prediction is the outcome for each case based on the model,

*The model is called model.


I am struggling to find the correct R code to make this correction. Is there a package that supports back transformation and if so does anyone know what this code is and how to compute the input terms within it?
 A: You didn't give any details about why you think the outputs are wildly unlikely, but my guess is that your errors are not normally distributed.  That "smearing adjustment" (bias correction) you're using is only valid if the errors are normal.
There is a more general smearing adjustment you can use, which is easy to implement.   If I recall correctly, and I think I do, the steps are:


*

*Compute $\exp(X\hat{\beta})$, i.e. the retransformed but unadjusted prediction.

*Regress $Y$ against $\exp(X\hat{\beta})$ without an intercept.  Call the resulting regression coefficient $\gamma$.

*Compute the adjusted retransformed prediction as $\gamma \exp(X\hat{\beta})$.


It's about the most intuitive thing you can do--forget the theory based on the normal distribution and just estimate the multiplier that gets the job done.
For details, see Duan, Naihua. “Smearing Estimate: A Nonparametric Retransformation Method.” Journal of the American Statistical Association, vol. 78, no. 383, 1983, pp. 605–610. JSTOR, JSTOR, www.jstor.org/stable/2288126.
