Hi,
I want to get fitted values from xtpoisson, fe. I can best illustrate my problem with the following data and code. Open up the dataset "ForStata". Then run the program below, and compare yvar with the 5 predicted values: yhat1-yhat5.
yvar is the dependent variable.
yhat1 comes from a GLM/family(poisson) link(log) model. Note how close yhat1 is to the dep. variable = yvar.
yhat2 and yhat3 come from an xtpoisson model (random effects). Note that the estimates are the same as the GLM estimates, and that yhat2=yhat3=yhat1.
yhat4 and yhat5 come from an xtpoisson model (fixed effects). Note that yhat4 and yhat5 are very different from the previous predicted values, and are not close to the dep variable.
QUESTION: Is there any way of getting predicted values from the xtpoisson model (fixed effects) so I can see how well it does in predicting the original dep variable and examine the residuals?
PROGRAM:
gen yvar = exports_ttl
glm exports_ttl ln_RGDP i.bothin i.year i.countrycode RER sd_RER, family(poisson) link(log)
predict yhat1
xtpoisson exports_ttl ln_RGDP i.bothin i.year i.countrycode RER sd_RER
predict yhat2, nu0
predict yhat3, iru0
xtpoisson exports_ttl ln_RGDP i.bothin i.year i.countrycode RER sd_RER, fe
predict yhat4, nu0
predict yhat5, iru0
// Compare yvar (the dep var) with the four predicted values in the data editor (browser)
I want to get fitted values from xtpoisson, fe. I can best illustrate my problem with the following data and code. Open up the dataset "ForStata". Then run the program below, and compare yvar with the 5 predicted values: yhat1-yhat5.
yvar is the dependent variable.
yhat1 comes from a GLM/family(poisson) link(log) model. Note how close yhat1 is to the dep. variable = yvar.
yhat2 and yhat3 come from an xtpoisson model (random effects). Note that the estimates are the same as the GLM estimates, and that yhat2=yhat3=yhat1.
yhat4 and yhat5 come from an xtpoisson model (fixed effects). Note that yhat4 and yhat5 are very different from the previous predicted values, and are not close to the dep variable.
QUESTION: Is there any way of getting predicted values from the xtpoisson model (fixed effects) so I can see how well it does in predicting the original dep variable and examine the residuals?
PROGRAM:
gen yvar = exports_ttl
glm exports_ttl ln_RGDP i.bothin i.year i.countrycode RER sd_RER, family(poisson) link(log)
predict yhat1
xtpoisson exports_ttl ln_RGDP i.bothin i.year i.countrycode RER sd_RER
predict yhat2, nu0
predict yhat3, iru0
xtpoisson exports_ttl ln_RGDP i.bothin i.year i.countrycode RER sd_RER, fe
predict yhat4, nu0
predict yhat5, iru0
// Compare yvar (the dep var) with the four predicted values in the data editor (browser)
Comment