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?

- Serverfault Help
- Superuser Help
- Ubuntu Help
- Webapps Help
- Webmasters Help
- Programmers Help
- Dba Help
- Drupal Help
- Wordpress Help
- Magento Help
- Joomla Help
- Android Help
- Apple Help
- Game Help
- Gaming Help
- Blender Help
- Ux Help
- Cooking Help
- Photo Help
- Stats Help
- Math Help
- Diy Help
- Gis Help
- Tex Help
- Meta Help
- Electronics Help
- Stackoverflow Help
- Bitcoin Help
- Ethereum Help