sysuse auto, clear
drop if rep78==.
gen lprice = log(price)
reghdfe lprice mpg i.foreign, absorb(FE=rep78) resid
margins foreign, expression(exp(predict(xb)+FE))
Predictive margins Number of obs = 69
Model VCE : OLS
Expression : exp(predict(xb)+FE)
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
foreign |
Domestic | 5492.019 287.0945 19.13 0.000 4929.324 6054.713
Foreign | 6576.807 604.7936 10.87 0.000 5391.434 7762.181
------------------------------------------------------------------------------
margins r.foreign, expression(exp(predict(xb)+FE))
Contrasts of predictive margins
Model VCE : OLS
Expression : exp(predict(xb)+FE)
------------------------------------------------
| df chi2 P>chi2
-------------+----------------------------------
foreign | 1 2.26 0.1328
------------------------------------------------
------------------------------------------------------------------------
| Delta-method
| Contrast Std. Err. [95% Conf. Interval]
-----------------------+------------------------------------------------
foreign |
(Foreign vs Domestic) | 1084.789 721.7383 -329.7924 2499.37
------------------------------------------------------------------------
It is a bit silly to do causal interpretation in this scenario, but setting that concern aside: "we assume that for the average car in the dataset, we could charge $5492 if the car is labeled as domestic, whereas it would have a price of $6577 if it was labeled as foreign. Although changing a car's classification to foreign is estimated to increase its value by about $1085, this difference is not statistically significant."
Questions:
- Is this the right way to convert my estimates back into $? (As I understand it reghdfe does not allow xbd prediction option: https://github.com/sergiocorreia/reghdfe/issues/138. Also, I am using the "expression" option because my understanding is that the typical recommended solution -- raw dependent variable with poisson or GLM before margins -- will be harder to implement in the high-dimensional fixed effects scenario).
- Is this the right interpretation of the results? e.g. are the estimates and confidence intervals coming out of these commands OK or are there issues with my transformation that I should be aware of?
- Has anyone experienced any problems with this type of postestimation using reghdfe? As Sergio notes on github, not all examples have been checked: https://github.com/sergiocorreia/reghdfe/issues/32
0 Response to Margins after REGHDFE with log dependent variable
Post a Comment