Hi All, I am estimating an event study plot, and I want to generate a 3 graphs: one with the "standard" xtevent, the second one with the overlay extrapolation line, and the third one with the extrapolated trend. This is an example of the dataset:
where perc_women is my outcome variable (percentage of elected women), treatment is my policyvariable, and year is the time variable. I first set the panel, which is strongly balanced. Then I run this code:
but I get this error: "matrix operators that return matrices not allowed in this context"
same if I do not specify gmm, as the default is actually the gmm. Differently, when I run the same code by using method(ols) it works and I get the plot I need. By reading online it seems there could be mispelling errors or similar, but honestly I cannot see what it is happening here.
Could anyone help? Thank you very much
Francesca
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(year id perc_women treatment) 2014 2 .16666667 0 2015 2 .16666667 0 2016 2 .16666667 0 2017 2 .16666667 0 2018 2 .16666667 1 2019 2 .16666667 1 2020 2 .16666667 1 2021 2 .5 1 2022 2 .5 1 2023 2 .5 1 2014 4 .3333333 0 2015 4 .3333333 0 2016 4 .3333333 0 2017 4 .3333333 0 2018 4 .16666667 1 2019 4 .16666667 1 2020 4 .16666667 1 2021 4 0 1 2022 4 0 1 2023 4 0 1 2014 5 0 0 2015 5 0 0 2016 5 0 0 2017 5 0 1 2018 5 0 1 2019 5 0 1 2020 5 0 1 2021 5 0 1 2022 5 0 1 2023 5 .3333333 1 2014 6 .16666667 0 2015 6 .16666667 0 2016 6 0 0 2017 6 .3333333 1 2018 6 .3333333 1 2019 6 .3333333 1 2020 6 .16666667 1 2021 6 .16666667 1 2022 6 .16666667 1 2023 6 .16666667 1 2014 8 0 0 2015 8 0 0 2016 8 0 0 2017 8 .3333333 1 2018 8 .3333333 1 2019 8 .3333333 1 2020 8 .3333333 1 2021 8 .3333333 1 2022 8 .3333333 1 2023 8 .5 1 2014 9 0 0 2015 9 0 0 2016 9 0 0 2017 9 .3333333 1 2018 9 .3333333 1 2019 9 .3333333 1 2020 9 .3333333 1 2021 9 .3333333 1 2022 9 .3333333 1 2023 9 .3333333 1 2014 11 .16666667 0 2015 11 .16666667 0 2016 11 .16666667 0 2017 11 .16666667 0 2018 11 .5 1 2019 11 .5 1 2020 11 .5 1 2021 11 0 1 2022 11 0 1 2023 11 0 1 2014 12 0 0 2015 12 0 0 2016 12 0 0 2017 12 0 0 2018 12 0 0 2019 12 .16666667 1 2020 12 .16666667 1 2021 12 .16666667 1 2022 12 .16666667 1 2023 12 .16666667 1 2014 14 0 0 2015 14 0 0 2016 14 0 0 2017 14 0 0 2018 14 0 0 2019 14 0 1 2020 14 0 1 2021 14 0 1 2022 14 0 1 2023 14 0 1 2014 15 .3333333 0 2015 15 .5 0 2016 15 .5 0 2017 15 .5 0 2018 15 .5 1 2019 15 .5 1 2020 15 .5 1 2021 15 .3333333 1 2022 15 .3333333 1 2023 15 .3333333 1 end
where perc_women is my outcome variable (percentage of elected women), treatment is my policyvariable, and year is the time variable. I first set the panel, which is strongly balanced. Then I run this code:
Code:
xtevent perc_women, policyvar(treatment) window(4) impute(stag) trend(-4, method(gmm) saveoverlay) xteventplot, overlay(trend)
same if I do not specify gmm, as the default is actually the gmm. Differently, when I run the same code by using method(ols) it works and I get the plot I need. By reading online it seems there could be mispelling errors or similar, but honestly I cannot see what it is happening here.
Could anyone help? Thank you very much
Francesca
Comment