Hi guys,
In my regression model, I need to control for year and industry fixed effects.
However, I'm not familiar with using this in a regression and the information on the internet does not help me any further.
See the CODE below for an example what my dataset looks like. Var1 is my dependent variable and var2 is my independent variable, which is a dummy variable. The others are all control variables, of which some are dummies. The first two columns are the fiscal year (fyear) and the CIK (identifier) numbers.
I read that the code for including year-fixed effects is xtreg, but how does this work? Do I simply type xtreg instead of regress to conduct the regression analysis? And is the only difference between the two the year-fixed effects? Or do I need another code? I already 'created' panel data by successfully using the xtset command.
Second, how does this work for industry fixed effects? I know that I need to have the SIC (industry) codes for the firms, but when I do, what code(s) do I need to type in order to get industry fixed effects, so that I will run the regression with both year- and industry-fixed effects?
In my regression model, I need to control for year and industry fixed effects.
However, I'm not familiar with using this in a regression and the information on the internet does not help me any further.
See the CODE below for an example what my dataset looks like. Var1 is my dependent variable and var2 is my independent variable, which is a dummy variable. The others are all control variables, of which some are dummies. The first two columns are the fiscal year (fyear) and the CIK (identifier) numbers.
I read that the code for including year-fixed effects is xtreg, but how does this work? Do I simply type xtreg instead of regress to conduct the regression analysis? And is the only difference between the two the year-fixed effects? Or do I need another code? I already 'created' panel data by successfully using the xtset command.
Second, how does this work for industry fixed effects? I know that I need to have the SIC (industry) codes for the firms, but when I do, what code(s) do I need to type in order to get industry fixed effects, so that I will run the regression with both year- and industry-fixed effects?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double fyear long CIK int var1 byte var2 float(logSIZE_w MTB_w) int AGE_IPO_w float(spiDummy LOGoneplusNBSEG_w LOGoneplusNGSEG_w ROA_w) byte(MAdummy SEOdummy DummyDLW) 2015 827871 100 0 7.234498 11.401678 1 0 1.3862944 .6931472 .10729168 0 1 1 2016 827871 99 0 7.103163 5.967246 2 1 1.3862944 .6931472 .1150776 0 0 1 2017 827871 100 0 6.675983 3.273505 3 1 1.3862944 .6931472 .035843123 0 0 1 2012 858339 96 0 6.765924 1.0428375 0 1 .6931472 .6931472 .004796609 0 1 1 2013 858339 101 0 7.988432 1.1964637 1 1 1.3862944 .6931472 .029811475 0 1 1 2014 858339 106 0 7.729757 1.2981538 2 1 2.772589 .6931472 .013939634 1 1 1 2015 858339 101 0 7.04233 .9107052 3 0 2.772589 .6931472 .28276432 0 0 1 2016 858339 104 0 7.130499 1.179099 4 1 2.772589 .6931472 .06878565 0 0 1 2017 858339 104 0 9.065615 1.209964 5 1 .6931472 .6931472 .07283562 1 0 1 2012 880177 90 1 6.189701 2.8622916 0 0 .6931472 .6931472 .015024709 0 1 1 2013 880177 93 1 5.490572 1.738865 1 0 .6931472 .6931472 .02839049 0 0 1 2015 883980 93 0 9.468133 1.310466 0 1 2.564949 1.94591 .01646152 0 1 1 2016 883980 92 0 9.468133 1.2168345 1 1 2.564949 1.94591 .0030276144 0 0 1 2017 883980 90 0 9.468133 1.194136 2 1 2.564949 1.94591 .0080108065 0 1 1 2017 912766 90 0 7.840877 1.0732107 0 1 .6931472 2.772589 .02082115 0 1 1 2014 921299 103 1 7.386668 3.840873 0 0 1.3862944 2.772589 .007237051 0 1 1 2015 921299 108 0 7.543635 4.595307 1 0 1.3862944 2.772589 .10401749 0 0 1
Comment