Dear Statalist,
I am much appreciated to have your advice on how to visualize my data.
I extract my firm-level dataset, as the below. The "treatment" == 1 if firm received subsidies and 0 otherwise. The subsidy took place once for each firm in any year between 2018-2023, so I used staggered difference-in-difference. "post" == 0 before the subsidy receipt and == 1 after subsidized. I used PSM to match control firm (treatment == 0) to treatment firm (treatment ==1). The "treatpost" is interaction between treatment and post. The "relativepost" is 0 on the year subsidy received, and (-1, -2,...) for preceeding years, and (1, 2,...) for the later years.
The DiD model is: ROE = alpha0 + alpha1*treatment + alpha2*post + alpha3*treatpost + Control (Logrevenue, Logasset, Age) + firm-fixed-effect(i) level + year-fixed-effect(t) level + residual (i,t).
The above model is estimated by fixed effect, control vce(cluster Country Sector). I have the "treatpost" is positive and significant.
Now, I want to visualize the data and my model. I am quite new to Stata and got some struggles.
Could you please suggest me with the Stata commands for a graph contains a window (-2 years, 2 years) of the "relativepost" that illustrates:
- Scattered points of ROE (original) (grouped colour by treatment == 1 and treatment == 0)
- predict lines for ROE (predicted) from the DiD regression for group treatment==1 and group treatment==0 in that (-2years, 2 years) "relativepost" window.
Thanks for any help.
Best regards.
I am much appreciated to have your advice on how to visualize my data.
I extract my firm-level dataset, as the below. The "treatment" == 1 if firm received subsidies and 0 otherwise. The subsidy took place once for each firm in any year between 2018-2023, so I used staggered difference-in-difference. "post" == 0 before the subsidy receipt and == 1 after subsidized. I used PSM to match control firm (treatment == 0) to treatment firm (treatment ==1). The "treatpost" is interaction between treatment and post. The "relativepost" is 0 on the year subsidy received, and (-1, -2,...) for preceeding years, and (1, 2,...) for the later years.
The DiD model is: ROE = alpha0 + alpha1*treatment + alpha2*post + alpha3*treatpost + Control (Logrevenue, Logasset, Age) + firm-fixed-effect(i) level + year-fixed-effect(t) level + residual (i,t).
The above model is estimated by fixed effect, control vce(cluster Country Sector). I have the "treatpost" is positive and significant.
RIC | Year | Country | Sector | ROE | Logrevenue | Logasset | Age | treatment | Year ref | post | treatpost | relativepost |
0004.HK | 2018 | Hong Kong | Real Estate | 3.8496 | 3.4295 | 4.4628 | 132 | 1 | 2021 | 0 | 0 | -3 |
0004.HK | 2019 | Hong Kong | Real Estate | 2.2496 | 3.3357 | 4.4927 | 133 | 1 | 2021 | 0 | 0 | -2 |
0004.HK | 2020 | Hong Kong | Real Estate | 3.2429 | 3.4327 | 4.5156 | 134 | 1 | 2021 | 0 | 0 | -1 |
0004.HK | 2021 | Hong Kong | Real Estate | 2.0497 | 3.4580 | 4.5125 | 135 | 1 | 2021 | 0 | 0 | 0 |
0004.HK | 2022 | Hong Kong | Real Estate | 0.8704 | 3.3642 | 4.4532 | 136 | 1 | 2021 | 1 | 1 | 1 |
0004.HK | 2023 | Hong Kong | Real Estate | 3.1272 | 3.3850 | 4.4189 | 137 | 1 | 2021 | 1 | 1 | 2 |
0012.HK | 2018 | Hong Kong | Real Estate | 2.4865 | 3.4482 | 4.7507 | 42 | 1 | 2021 | 0 | 0 | -3 |
0012.HK | 2019 | Hong Kong | Real Estate | 2.3506 | 3.4920 | 4.7667 | 43 | 1 | 2021 | 0 | 0 | -2 |
0012.HK | 2020 | Hong Kong | Real Estate | 2.6396 | 3.5089 | 4.7744 | 44 | 1 | 2021 | 0 | 0 | -1 |
0012.HK | 2021 | Hong Kong | Real Estate | 2.1788 | 3.4797 | 4.8487 | 45 | 1 | 2021 | 0 | 0 | 0 |
0012.HK | 2022 | Hong Kong | Real Estate | 1.3604 | 3.5148 | 4.8315 | 46 | 1 | 2021 | 1 | 1 | 1 |
0012.HK | 2023 | Hong Kong | Real Estate | 1.4574 | 3.5479 | 4.8419 | 47 | 1 | 2021 | 1 | 1 | 2 |
0016.HK | 2018 | Hong Kong | Real Estate | 7.1595 | 4.0380 | 4.9599 | 46 | 0 | 2019 | 0 | 0 | -1 |
0016.HK | 2019 | Hong Kong | Real Estate | 6.7087 | 4.0382 | 4.9829 | 47 | 0 | 2019 | 0 | 0 | 0 |
0016.HK | 2020 | Hong Kong | Real Estate | 3.8895 | 4.0279 | 5.0126 | 48 | 0 | 2019 | 1 | 0 | 1 |
0016.HK | 2021 | Hong Kong | Real Estate | 4.6766 | 4.0407 | 5.0111 | 49 | 0 | 2019 | 1 | 0 | 2 |
0016.HK | 2022 | Hong Kong | Real Estate | 4.1312 | 3.9960 | 5.0125 | 50 | 0 | 2019 | 1 | 0 | 3 |
0016.HK | 2023 | Hong Kong | Real Estate | 3.4175 | 3.9584 | 5.0122 | 51 | 0 | 2019 | 1 | 0 | 4 |
5010.T | 2018 | Japan | Energy | 0.5864 | 2.4316 | 2.4800 | 67 | 0 | 2022 | 0 | 0 | -4 |
5010.T | 2019 | Japan | Energy | -1.9996 | 2.3997 | 2.4761 | 68 | 0 | 2022 | 0 | 0 | -3 |
5010.T | 2020 | Japan | Energy | -6.7176 | 2.3332 | 2.4745 | 69 | 0 | 2022 | 0 | 0 | -2 |
5010.T | 2021 | Japan | Energy | 1.7664 | 2.3849 | 2.4650 | 70 | 0 | 2022 | 0 | 0 | -1 |
5010.T | 2022 | Japan | Energy | -6.1494 | 2.4673 | 2.4032 | 71 | 0 | 2022 | 0 | 0 | 0 |
5010.T | 2023 | Japan | Energy | -4.2699 | 2.1871 | 2.3277 | 72 | 0 | 2022 | 1 | 0 | 1 |
Could you please suggest me with the Stata commands for a graph contains a window (-2 years, 2 years) of the "relativepost" that illustrates:
- Scattered points of ROE (original) (grouped colour by treatment == 1 and treatment == 0)
- predict lines for ROE (predicted) from the DiD regression for group treatment==1 and group treatment==0 in that (-2years, 2 years) "relativepost" window.
Thanks for any help.
Best regards.
Comment