0
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ What is the question? Is the question how to land on your feet? ... No, seriously it would be nice if you could us math type setting and state a little more clearly what it is you would like help with. $\endgroup$ Oct 17, 2019 at 12:57
  • $\begingroup$ Here is a piece of code to illustrate what I would like : in this code I would like to find the same value as mean(Y), but from the predicted values (what I tried to do at he last line) eps<-rnorm(1000,0,0.11) X<-rnorm(1000,1.8,0.5) a<-0.5 b<-1.2 Y=exp(a+bX+eps) log_Y<-log(Y) mean(Y) res<-summary(lm(log_Y~X)) achap<-coef(res)[1,1] bchap<-coef(res)[2,1] Ypred<-achap+bchapX mean(exp(Ypred)) var_res<-sigma(lm(log_Y~X))**2 mean(exp(Ypred+var_res/2)) $\endgroup$
    – thogs
    Oct 17, 2019 at 13:13
  • 1
    $\begingroup$ stats.stackexchange.com/search?q=duan+smear $\endgroup$
    – whuber
    Oct 17, 2019 at 13:42
  • $\begingroup$ You seem to be requesting two contradictory things: with this model, there's no assurance the mean predicted value of the $y_i$ will equal the original mean. You could impose that constraint, but only by (a) complicating the model; (b) making it worse in most respects; and (c) rendering any hypothesis tests suspect. Which, then is more important: having a good fit to an appropriate model or reproducing the mean of (explicitly random) responses exactly? $\endgroup$
    – whuber
    Oct 17, 2019 at 18:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.