Hi everyone,
I'm trying to test for the parallel trend assumption in the difference in difference. I'm trying to estimate this two way fixed effect model.
xtpcse lunemployment_rate uber i.uber##time_fe2-timefe97 CMA_fe2-CMA_fe34 time_fe2-time_fe97
My panel data is monthly. Uber is a dummy variable that is equal to one whenever uber enters a Metropolitan area and zero if not. Uber didn't enter into some areas which make it zero for all months for this area. I have a metropolitan area fixed effects, time fixed effects. The time fixed effects are generated from month and year using this code: "gen month_year = ym(YEAR, MONTH)
format month_year %tm" and then
"tab month_year, gen(time_fe)"
I'm trying to interact my uber dummy variable with the time fixed effects in order to have leads and lags that I can test with the parallel trends assumption. Please see below a sample of my data.I have 97 periods per metropolitan area. I only included two fixed effects variables down.
I have two questions:
1) How can I include only months fixed effects if my data is a panel? (It gave me an error message when I tried to do so, I resorted then to a year and month fixed effects combined)
2) How do I generate the leads and lags interaction factor in order to test for the parallel trends assumption for the difference in difference?
please let me know if you need any more information. I have been trying to generate this interaction factor for the past 3 days. Any help is appreciated.
Thank you,
Ahmad
* Example generated by -dataex-. To install: ssc install dataex
clear
input float uber byte(time_fe2 time_fe3) float month_year byte MONTH int YEAR
0 0 0 605 6 2010
0 1 0 606 7 2010
0 0 1 607 8 2010
0 0 0 608 9 2010
0 0 0 609 10 2010
0 0 0 610 11 2010
0 0 0 611 12 2010
0 0 0 612 1 2011
0 0 0 613 2 2011
0 0 0 614 3 2011
0 0 0 615 4 2011
0 0 0 616 5 2011
0 0 0 617 6 2011
0 0 0 618 7 2011
0 0 0 619 8 2011
0 0 0 620 9 2011
0 0 0 621 10 2011
0 0 0 622 11 2011
0 0 0 623 12 2011
0 0 0 624 1 2012
0 0 0 625 2 2012
0 0 0 626 3 2012
0 0 0 627 4 2012
0 0 0 628 5 2012
0 0 0 629 6 2012
0 0 0 630 7 2012
0 0 0 631 8 2012
0 0 0 632 9 2012
0 0 0 633 10 2012
0 0 0 634 11 2012
0 0 0 635 12 2012
0 0 0 636 1 2013
0 0 0 637 2 2013
0 0 0 638 3 2013
0 0 0 639 4 2013
0 0 0 640 5 2013
0 0 0 641 6 2013
0 0 0 642 7 2013
0 0 0 643 8 2013
0 0 0 644 9 2013
0 0 0 645 10 2013
0 0 0 646 11 2013
0 0 0 647 12 2013
0 0 0 648 1 2014
0 0 0 649 2 2014
0 0 0 650 3 2014
0 0 0 651 4 2014
0 0 0 652 5 2014
0 0 0 653 6 2014
0 0 0 654 7 2014
0 0 0 655 8 2014
0 0 0 656 9 2014
0 0 0 657 10 2014
0 0 0 658 11 2014
0 0 0 659 12 2014
0 0 0 660 1 2015
0 0 0 661 2 2015
0 0 0 662 3 2015
0 0 0 663 4 2015
0 0 0 664 5 2015
0 0 0 665 6 2015
0 0 0 666 7 2015
0 0 0 667 8 2015
0 0 0 668 9 2015
0 0 0 669 10 2015
0 0 0 670 11 2015
0 0 0 671 12 2015
0 0 0 672 1 2016
0 0 0 673 2 2016
0 0 0 674 3 2016
0 0 0 675 4 2016
0 0 0 676 5 2016
0 0 0 677 6 2016
0 0 0 678 7 2016
0 0 0 679 8 2016
0 0 0 680 9 2016
0 0 0 681 10 2016
0 0 0 682 11 2016
0 0 0 683 12 2016
0 0 0 684 1 2017
0 0 0 685 2 2017
0 0 0 686 3 2017
0 0 0 687 4 2017
0 0 0 688 5 2017
0 0 0 689 6 2017
0 0 0 690 7 2017
0 0 0 691 8 2017
0 0 0 692 9 2017
0 0 0 693 10 2017
0 0 0 694 11 2017
0 0 0 695 12 2017
0 0 0 696 1 2018
0 0 0 697 2 2018
0 0 0 698 3 2018
0 0 0 699 4 2018
0 0 0 700 5 2018
0 0 0 701 6 2018
0 0 0 605 6 2010
0 1 0 606 7 2010
0 0 1 607 8 2010
end
format %tm month_year
[/CODE]
------------------ copy up to and including the previous line ------------------
Listed 100 out of 3298 observations
I'm trying to test for the parallel trend assumption in the difference in difference. I'm trying to estimate this two way fixed effect model.
xtpcse lunemployment_rate uber i.uber##time_fe2-timefe97 CMA_fe2-CMA_fe34 time_fe2-time_fe97
My panel data is monthly. Uber is a dummy variable that is equal to one whenever uber enters a Metropolitan area and zero if not. Uber didn't enter into some areas which make it zero for all months for this area. I have a metropolitan area fixed effects, time fixed effects. The time fixed effects are generated from month and year using this code: "gen month_year = ym(YEAR, MONTH)
format month_year %tm" and then
"tab month_year, gen(time_fe)"
I'm trying to interact my uber dummy variable with the time fixed effects in order to have leads and lags that I can test with the parallel trends assumption. Please see below a sample of my data.I have 97 periods per metropolitan area. I only included two fixed effects variables down.
I have two questions:
1) How can I include only months fixed effects if my data is a panel? (It gave me an error message when I tried to do so, I resorted then to a year and month fixed effects combined)
2) How do I generate the leads and lags interaction factor in order to test for the parallel trends assumption for the difference in difference?
please let me know if you need any more information. I have been trying to generate this interaction factor for the past 3 days. Any help is appreciated.
Thank you,
Ahmad
* Example generated by -dataex-. To install: ssc install dataex
clear
input float uber byte(time_fe2 time_fe3) float month_year byte MONTH int YEAR
0 0 0 605 6 2010
0 1 0 606 7 2010
0 0 1 607 8 2010
0 0 0 608 9 2010
0 0 0 609 10 2010
0 0 0 610 11 2010
0 0 0 611 12 2010
0 0 0 612 1 2011
0 0 0 613 2 2011
0 0 0 614 3 2011
0 0 0 615 4 2011
0 0 0 616 5 2011
0 0 0 617 6 2011
0 0 0 618 7 2011
0 0 0 619 8 2011
0 0 0 620 9 2011
0 0 0 621 10 2011
0 0 0 622 11 2011
0 0 0 623 12 2011
0 0 0 624 1 2012
0 0 0 625 2 2012
0 0 0 626 3 2012
0 0 0 627 4 2012
0 0 0 628 5 2012
0 0 0 629 6 2012
0 0 0 630 7 2012
0 0 0 631 8 2012
0 0 0 632 9 2012
0 0 0 633 10 2012
0 0 0 634 11 2012
0 0 0 635 12 2012
0 0 0 636 1 2013
0 0 0 637 2 2013
0 0 0 638 3 2013
0 0 0 639 4 2013
0 0 0 640 5 2013
0 0 0 641 6 2013
0 0 0 642 7 2013
0 0 0 643 8 2013
0 0 0 644 9 2013
0 0 0 645 10 2013
0 0 0 646 11 2013
0 0 0 647 12 2013
0 0 0 648 1 2014
0 0 0 649 2 2014
0 0 0 650 3 2014
0 0 0 651 4 2014
0 0 0 652 5 2014
0 0 0 653 6 2014
0 0 0 654 7 2014
0 0 0 655 8 2014
0 0 0 656 9 2014
0 0 0 657 10 2014
0 0 0 658 11 2014
0 0 0 659 12 2014
0 0 0 660 1 2015
0 0 0 661 2 2015
0 0 0 662 3 2015
0 0 0 663 4 2015
0 0 0 664 5 2015
0 0 0 665 6 2015
0 0 0 666 7 2015
0 0 0 667 8 2015
0 0 0 668 9 2015
0 0 0 669 10 2015
0 0 0 670 11 2015
0 0 0 671 12 2015
0 0 0 672 1 2016
0 0 0 673 2 2016
0 0 0 674 3 2016
0 0 0 675 4 2016
0 0 0 676 5 2016
0 0 0 677 6 2016
0 0 0 678 7 2016
0 0 0 679 8 2016
0 0 0 680 9 2016
0 0 0 681 10 2016
0 0 0 682 11 2016
0 0 0 683 12 2016
0 0 0 684 1 2017
0 0 0 685 2 2017
0 0 0 686 3 2017
0 0 0 687 4 2017
0 0 0 688 5 2017
0 0 0 689 6 2017
0 0 0 690 7 2017
0 0 0 691 8 2017
0 0 0 692 9 2017
0 0 0 693 10 2017
0 0 0 694 11 2017
0 0 0 695 12 2017
0 0 0 696 1 2018
0 0 0 697 2 2018
0 0 0 698 3 2018
0 0 0 699 4 2018
0 0 0 700 5 2018
0 0 0 701 6 2018
0 0 0 605 6 2010
0 1 0 606 7 2010
0 0 1 607 8 2010
end
format %tm month_year
[/CODE]
------------------ copy up to and including the previous line ------------------
Listed 100 out of 3298 observations
Comment