I am trying to compute a counterfactual prediction if a certain explanatory variable had different values.
Here is a simple example using the auto dataset:
Code:
sysuse auto // Run linear regression with fixed effects reghdfe price mpg, a(foreign) resid // Generate predicted values (requires "resid" option for previous command) predict price_prediction_actual, xbd // Adjust values for counterfactual replace mpg = 500 // Generate counterfactual prediction (i.e., price estimate if all observed cars had driven exactly 500 miles) predict price_prediction_counterfactual, xbd
This seems to be specific to the reghdfe command, since the following works:
Code:
sysuse auto reg price mpg i.foreign predict price_prediction_actual replace mpg = 500 predict price_prediction_counterfactual
Many thanks in advance and kind regards,
John Hanser
0 Response to Predicting counterfactual from reghdfe
Post a Comment