0

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.

Jesper for President
  • 5,520
  • 2
  • 21
  • 45
thogs
  • 41
  • 5
  • 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. – Jesper for President Oct 17 '19 at 12:57
  • 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+b*X+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+bchap*X
    
    

    mean(exp(Ypred)) var_res<-sigma(lm(log_Y~X))**2 mean(exp(Ypred+var_res/2))

    – thogs Oct 17 '19 at 13:13
  • 1
    https://stats.stackexchange.com/search?q=duan+smear – whuber Oct 17 '19 at 13:42
  • 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? – whuber Oct 17 '19 at 18:29

0 Answers0