I have a logarithmic linear function:
lom1 = lm(log(y)~log(x1)+log(x2),data=mod_dt)
I want to get y_hat using the same dataset and I did
yhat = exp(predict(lom1))
The result seems a lot (compared to the y-hat, which I calculated manually in R).
Any reason?
Second related question: I first added three more columns in the original mod_dt dataset for the logarithmic transforms y, x1, and x2. Let's say they are called logy, logx1 and logx2, and then I ran lm:
lom2 = lm(logy ~ logx1 + logx2, data=mod_dt)
This gives a different set of coefficients.
Can this give the right y-hat by doing
exp(predict(lom2))
Thank you very much in advance.
source share