I need help with detrending panel data.
I have a panel of firm observations across years and industries. I want to detrend the performance variable (ROA) to remove year and industry effects so i can use the detrennded variable on the left hand side of another model that does not work well with controls, thus requiring ex-ante detrending.
My idea was to simply run the following code, essentially regressing ROA on a set of multiplicative year X industry dummies, and use the residuals as the detrended variable.
Code:
gen indxyear=ind*year tab indxyear, gen(trenddummy) reghdfe roa trenddummy*, nosample fastregress residual(res_roa)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long id double year float(roa ind) 1380 1992 .020091366 3 1380 1993 -.010184983 3 1380 1994 .04607277 3 1380 1995 .03616318 3 1380 1996 .06704622 3 1380 1997 .029870747 3 1380 1998 -.0048403 3 1408 1992 .11132794 1 1408 1993 .08327315 1 1408 1994 .1268582 1 1408 1995 .1289832 1 1408 1996 .11449675 1 1408 1997 .08191574 1 1408 1998 .08418822 1 1609 1992 .036867816 3 1609 1993 .0833743 3 1609 1994 .06494747 3 1609 1995 .0918747 3 1609 1996 .11155763 3 1609 1997 .10006464 3 1661 1992 .10992254 3 1661 1993 .07423703 3 1661 1994 .0861485 3 1661 1995 .10034772 3 1661 1996 .08848996 3 1661 1997 .12681246 3 1661 1998 .12572937 3 1663 1992 .16850606 1 1663 1993 .1633135 1 1663 1994 .17193583 1 1663 1995 .16928685 1 1663 1996 .19391987 1 1663 1997 .1750646 1 1663 1998 .17023782 1 1678 1992 .06116251 3 1678 1993 .05108807 3 1678 1994 .04647045 3 1678 1995 .04226407 3 1678 1996 .07594678 3 1678 1997 .08104512 3 1678 1998 -.029105654 3 1722 1993 .08783213 1 1722 1994 .08761986 1 1722 1995 .12433536 1 1722 1996 .08750617 1 1722 1997 .07014403 1 1722 1998 .05553664 1 end
0 Response to De-trending Panel Data
Post a Comment