Dear Statlisters,
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:
Unfortunately, the two predictions are identical... so they do not reflect the adjustment to the mpg variable.
This seems to be specific to the reghdfe command, since the following works:
I am somewhat forced to do this analysis with reghdfe. Therefore, does anyone know how to resolve this?
Many thanks in advance and kind regards,
John Hanser
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

Comment