hello,
I'm new to the statalist forum. I have searched the forum but it seems there's no specific answer to my question, so I start a new post. I want to replicate a paper, which has an indicator variable called "high comovement in asset growth", as per the paper, this variable is calculated as follows:
"Indicator variable taking the value of 1 for industries with high comovement in asset growth, and 0 otherwise. To measure comovement in asset growth, we first obtain the R-squared from regressions, by industry, of firms’ standardized asset growth on year indicators. We then residualize the R-Squared with respect to the number of firms operating in the industry, and define high-comovement industries as those in the upper quartile of the distribution of residualized R-squareds."
I have all the necessary variables, my data is panel data, which is xtset firm year, yearly. I wonder how can I write code in stata to achieve this and therefore obtain the indicator variable? I think the only part I know is the last bit, "define high-comovement industries as those in the upper quartile of the distribution of residualized R-squareds", I could do something like this:
Thanks a lot in advance for any help.
I'm new to the statalist forum. I have searched the forum but it seems there's no specific answer to my question, so I start a new post. I want to replicate a paper, which has an indicator variable called "high comovement in asset growth", as per the paper, this variable is calculated as follows:
"Indicator variable taking the value of 1 for industries with high comovement in asset growth, and 0 otherwise. To measure comovement in asset growth, we first obtain the R-squared from regressions, by industry, of firms’ standardized asset growth on year indicators. We then residualize the R-Squared with respect to the number of firms operating in the industry, and define high-comovement industries as those in the upper quartile of the distribution of residualized R-squareds."
I have all the necessary variables, my data is panel data, which is xtset firm year, yearly. I wonder how can I write code in stata to achieve this and therefore obtain the indicator variable? I think the only part I know is the last bit, "define high-comovement industries as those in the upper quartile of the distribution of residualized R-squareds", I could do something like this:
Code:
egen quantiles_comovement = xtile(comovement), by(year industry) nq(2) gen high_comovement = 1 if quantiles_comovement == 2 replace high_comovement = 0 if quantiles_comovement == 1