I run a log linear model $$\log(Y)=\alpha + \beta X + \epsilon$$
and wonder how to calculate the mean of predicted values, in the same dimension as the initial (untransformed) variable Y. I would like to find the same value than the variable $Y$, calculated on the data.
I applied the formula that I have found on this link : https://davegiles.blogspot.com/2013/08/forecasting-from-log-linear-regressions.html, but with the formula mean of $$y_t^* = \exp\{\log(y_t)^* + ( s^2 / 2)\}$$
where
$$\log(y_t)^* := \widehat{log Y}=\hat \alpha + \hat \beta X$$
I can't land on my feet.
mean(exp(Ypred)) var_res<-sigma(lm(log_Y~X))**2 mean(exp(Ypred+var_res/2))
– thogs Oct 17 '19 at 13:13