Hi.
I have the following model:
xtreg ln_price ratio ratio2 ratio3 ln_gdp ln_export, fe cluster(prod)
(where fixed effects are at the product level, ratio2 is the squared value of ratio, and ratio3 is the cubic value of ratio).
I would like to plot the relationship between "ratio" and "ln_price", where the predicted value of "ln_price" is computed at the average value of covariates ("ln_gdp" and "ln_export"). I would also like to plot the confidence intervals.
Since I was not able to find a Stata command to compute the conditional predicted mean, what I am doing now is the following:
1) Is there a Stata command to compute the conditional predicted mean? I am using Stata14.
2) How could I compute the confidence intervals in this case?
I have the following model:
xtreg ln_price ratio ratio2 ratio3 ln_gdp ln_export, fe cluster(prod)
(where fixed effects are at the product level, ratio2 is the squared value of ratio, and ratio3 is the cubic value of ratio).
I would like to plot the relationship between "ratio" and "ln_price", where the predicted value of "ln_price" is computed at the average value of covariates ("ln_gdp" and "ln_export"). I would also like to plot the confidence intervals.
Since I was not able to find a Stata command to compute the conditional predicted mean, what I am doing now is the following:
Code:
xtreg ln_price ratio ratio2 ratio3 ln_gdp ln_export, fe cluster(prod) matrix list e(b) scalar cons=_b[_cons] scalar b1=_b[ratio] scalar b2=_b[ratio2] scalar b3=_b[ratio3] scalar a1=_b[ln_gdp_pc_e] scalar a2=_b[ln_export_e] egen ln_gdp_mean= mean(ln_gdp_pc_e) egen ln_export_mean= mean(ln_export_e) gen yhat= cons+b1*ratio +b2*ratio2 +b3*ratio3 +a1*ln_gdp_mean +a2*ln_export_mean twoway (line yhat ratio)
2) How could I compute the confidence intervals in this case?

Comment