Dear all,
I attached an example of the sample which is a panel dataset. I have two firms X, and Y, observations are by year and quarter (fqtr 1,2,3,4). ID is the unique firm identifier.
Question :
In areg model, I control for ID (firm id) year, quarter fixed effect, I first generate the following variable
egen yr_qtr=group(fyearq fqtr )
then
areg yvar x1 x2 x3 $yrqtr, absorb(ID)
Is this the right way for fixed effect I described above?
* Example generated by -dataex-. For more info, type help dataex
clear
input int ID str1 Company int(datadate fyearq) byte fqtr double(x1 x2 x3 yvar) str5 Relation
4839 "X" 21639 2019 1 8.78 .006202498450875282 .2533224821090698 .4352763891220093 "T2"
4839 "X" 21274 2018 1 11.08 .006657186895608902 .24117426574230194 .649627685546875 "T3"
4839 "X" 21274 2018 1 11.08 .006657186895608902 .24117426574230194 .649627685546875 "T1-T3"
4839 "X" 21365 2018 2 11.07 .014290197752416134 .2516477406024933 .4130518138408661 "T3"
4839 "X" 21365 2018 2 11.07 .014290197752416134 .2516477406024933 .4130518138408661 "T1-T3"
4839 "X" 21365 2018 2 11.07 .014290197752416134 .2516477406024933 .4130518138408661 "T1"
4839 "X" 21365 2018 2 11.07 .014290197752416134 .2516477406024933 .4130518138408661 "T2"
4839 "X" 21457 2018 3 9.25 .021890904754400253 .252164363861084 .3826757073402405 "T1-T3"
4839 "X" 21457 2018 3 9.25 .021890904754400253 .252164363861084 .3826757073402405 "T1"
4839 "X" 21549 2018 4 7.65 .03034614399075508 .25452950596809387 -.0452171191573143 "T2"
4839 "X" 21549 2018 4 7.65 .03034614399075508 .25452950596809387 -.0452171191573143 "T3"
4839 "X" 21639 2019 1 8.78 .006202498450875282 .2533224821090698 .4352763891220093 "T1-T3"
4839 "X" 21639 2019 1 8.78 .006202498450875282 .2533224821090698 .4352763891220093 "T1"
4839 "X" 21730 2019 2 10.23 .013551551848649979 .2581316828727722 .056448906660079956 "T1"
4839 "X" 21730 2019 2 10.23 .013551551848649979 .2581316828727722 .056448906660079956 "T2"
4839 "X" 21730 2019 2 10.23 .013551551848649979 .2581316828727722 .056448906660079956 "T3"
5073 "Y" 21549 2018 4 7.65 .03034614399075508 .25452950596809387 -.0452171191573143 "T1-T3"
5073 "Y" 21274 2018 1 11.08 .006657186895608902 .24117426574230194 .649627685546875 "T2"
5073 "Y" 21274 2018 1 11.08 .006657186895608902 .24117426574230194 .649627685546875 "T1"
5073 "Y" 21457 2018 3 9.25 .021890904754400253 .252164363861084 .3826757073402405 "T2"
5073 "Y" 21457 2018 3 9.25 .021890904754400253 .252164363861084 .3826757073402405 "T3"
5073 "Y" 21549 2018 4 7.65 .03034614399075508 .25452950596809387 -.0452171191573143 "T1"
5073 "Y" 21639 2019 1 8.78 .006202498450875282 .2533224821090698 .4352763891220093 "T3"
5073 "Y" 21730 2019 2 10.23 .013551551848649979 .2581316828727722 .056448906660079956 "T1-T3"
By the way, I have not posted for a long while, and forgot about how to disply data in a box.
Thanks in advance
Rochelle
I attached an example of the sample which is a panel dataset. I have two firms X, and Y, observations are by year and quarter (fqtr 1,2,3,4). ID is the unique firm identifier.
Question :
In areg model, I control for ID (firm id) year, quarter fixed effect, I first generate the following variable
egen yr_qtr=group(fyearq fqtr )
then
areg yvar x1 x2 x3 $yrqtr, absorb(ID)
Is this the right way for fixed effect I described above?
* Example generated by -dataex-. For more info, type help dataex
clear
input int ID str1 Company int(datadate fyearq) byte fqtr double(x1 x2 x3 yvar) str5 Relation
4839 "X" 21639 2019 1 8.78 .006202498450875282 .2533224821090698 .4352763891220093 "T2"
4839 "X" 21274 2018 1 11.08 .006657186895608902 .24117426574230194 .649627685546875 "T3"
4839 "X" 21274 2018 1 11.08 .006657186895608902 .24117426574230194 .649627685546875 "T1-T3"
4839 "X" 21365 2018 2 11.07 .014290197752416134 .2516477406024933 .4130518138408661 "T3"
4839 "X" 21365 2018 2 11.07 .014290197752416134 .2516477406024933 .4130518138408661 "T1-T3"
4839 "X" 21365 2018 2 11.07 .014290197752416134 .2516477406024933 .4130518138408661 "T1"
4839 "X" 21365 2018 2 11.07 .014290197752416134 .2516477406024933 .4130518138408661 "T2"
4839 "X" 21457 2018 3 9.25 .021890904754400253 .252164363861084 .3826757073402405 "T1-T3"
4839 "X" 21457 2018 3 9.25 .021890904754400253 .252164363861084 .3826757073402405 "T1"
4839 "X" 21549 2018 4 7.65 .03034614399075508 .25452950596809387 -.0452171191573143 "T2"
4839 "X" 21549 2018 4 7.65 .03034614399075508 .25452950596809387 -.0452171191573143 "T3"
4839 "X" 21639 2019 1 8.78 .006202498450875282 .2533224821090698 .4352763891220093 "T1-T3"
4839 "X" 21639 2019 1 8.78 .006202498450875282 .2533224821090698 .4352763891220093 "T1"
4839 "X" 21730 2019 2 10.23 .013551551848649979 .2581316828727722 .056448906660079956 "T1"
4839 "X" 21730 2019 2 10.23 .013551551848649979 .2581316828727722 .056448906660079956 "T2"
4839 "X" 21730 2019 2 10.23 .013551551848649979 .2581316828727722 .056448906660079956 "T3"
5073 "Y" 21549 2018 4 7.65 .03034614399075508 .25452950596809387 -.0452171191573143 "T1-T3"
5073 "Y" 21274 2018 1 11.08 .006657186895608902 .24117426574230194 .649627685546875 "T2"
5073 "Y" 21274 2018 1 11.08 .006657186895608902 .24117426574230194 .649627685546875 "T1"
5073 "Y" 21457 2018 3 9.25 .021890904754400253 .252164363861084 .3826757073402405 "T2"
5073 "Y" 21457 2018 3 9.25 .021890904754400253 .252164363861084 .3826757073402405 "T3"
5073 "Y" 21549 2018 4 7.65 .03034614399075508 .25452950596809387 -.0452171191573143 "T1"
5073 "Y" 21639 2019 1 8.78 .006202498450875282 .2533224821090698 .4352763891220093 "T3"
5073 "Y" 21730 2019 2 10.23 .013551551848649979 .2581316828727722 .056448906660079956 "T1-T3"
By the way, I have not posted for a long while, and forgot about how to disply data in a box.
Thanks in advance
Rochelle
Comment