Dear all
I am running an OLS regression with a panel dataset. There is an observation for each firm-calendar month. I want to cluster the standard errors by both firm and month level. I also want to control for firm fixed effects simultaneously. I am aware of cluster2 and cgmreg commands in Stata to do double clustering, but I haven't found a way to control for firm fixed effect using these two commands. As I have 15,000+ firms, if I use 'xi:cluster2 y x i.firmid', Stata will generate two many firm dummies and the running time is very long. Stata ends up reporting the following error. I was wondering if there is an efficient way to do this, like 'areg, absorb' which does not generate and report those firm dummies. Any help would be much appreciated!
"characteristic contents too long
The maximum value of the contents is 67,784.
characteristic contents too long
The maximum value of the contents is 67,784.
characteristic contents too long
The maximum value of the contents is 67,784.
matsize too small
You have attempted to create a matrix with too many rows or columns or
attempted to fit a model with too many variables. You need to increase
matsize; it is currently 400. Use set matsize; see help matsize.
If you are using factor variables and included an interaction that has
lots of missing cells, either increase matsize or set emptycells drop
to reduce the required matrix size; see help set emptycells.
If you are using factor variables, you might have accidentally treated
a continuous variable as a categorical, resulting in lots of
categories. Use the c. operator on such variables."
Best regards
Shuang
I am running an OLS regression with a panel dataset. There is an observation for each firm-calendar month. I want to cluster the standard errors by both firm and month level. I also want to control for firm fixed effects simultaneously. I am aware of cluster2 and cgmreg commands in Stata to do double clustering, but I haven't found a way to control for firm fixed effect using these two commands. As I have 15,000+ firms, if I use 'xi:cluster2 y x i.firmid', Stata will generate two many firm dummies and the running time is very long. Stata ends up reporting the following error. I was wondering if there is an efficient way to do this, like 'areg, absorb' which does not generate and report those firm dummies. Any help would be much appreciated!
"characteristic contents too long
The maximum value of the contents is 67,784.
characteristic contents too long
The maximum value of the contents is 67,784.
characteristic contents too long
The maximum value of the contents is 67,784.
matsize too small
You have attempted to create a matrix with too many rows or columns or
attempted to fit a model with too many variables. You need to increase
matsize; it is currently 400. Use set matsize; see help matsize.
If you are using factor variables and included an interaction that has
lots of missing cells, either increase matsize or set emptycells drop
to reduce the required matrix size; see help set emptycells.
If you are using factor variables, you might have accidentally treated
a continuous variable as a categorical, resulting in lots of
categories. Use the c. operator on such variables."
Best regards
Shuang
Comment