Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clustering SEs

    Hi all,

    I have a question regarding some clustering of standard errors. I read a great paper by M. A. Petersen: Estimating standard errors in finance panel data sets: comparing approaches. After reading this paper I found out that I need to double-cluster my standard errors in order to account for the, as in the paper called, unobserved firm effects and the time effect. The unobserved firm effect is serial correlation: of observation i, the SEs are correlated between t and t-1. The time effect is a cross sectional correlation: in a single year, the standard errors of multiple firms are correlated to one another.

    through this paper, I found out that I should use the user-written reghdfe command. This would allow for double clustering of standard errors. I am, however, dumbfounded on one aspect. I need to absorb a categorical variable, just as in the areg command.




    How would I go about this? I currently have the following command:

    xtreg $ylist $h1 i.Quarter, cluster(busseccode) fe. the i.Quarter is there to control for some time-fixed effects ( if I am interpreting it correctly). It simply equals 1 if it is quarter 1, 2 if it is quarter 2 ... all the way until the last quarter in year 18: 64.

    The busseccode is the TRBC business sector code. this contains 29 different sectors in which all the firms of my database are sectioned in.

    I do not really have another categorical variable. I wanted to cluster my standard errors on the Quarter and busseccode. However, what categorical variable should I then absorb?




    If someone is able to help me, I would seriously appreciate it.


    I am, unfortunately, not allowed to share the data. If anyone needs more information on the data I can gladly give that, but I cannot give the raw data.

  • #2
    Code:
    reghdfe [depvar] [indepvar], absorb([unitvar Quarter]) cluster(busseccode)
    This paper is also excellent concerning standard errors: https://arxiv.org/abs/1710.02926

    Comment


    • #3
      Originally posted by Maxence Morlet View Post
      Code:
      reghdfe [depvar] [indepvar], absorb([unitvar Quarter]) cluster(busseccode)
      This paper is also excellent concerning standard errors: https://arxiv.org/abs/1710.02926
      Hi Maxence, thanks for the quick response. I am unsure of one thing, what do you mean with the unitvar in the absorb([]) part.

      And perhaps you are able to help me with one more question. When I use the command:
      xtreg $ylist $h1, cluster(busseccode) fe, I get the following # obs 98952 and 2252 groups. I am unsure where those 2252 groups come from, as it says that my SEs are adjusted for 29 clusters.

      Comment


      • #4
        1. When you xtset your data, what variable did you employ as x variable? I mean that variable.

        2. 29 clusters (of the [clustvar]) were employed in the analysis. A cluster here means a unit, so in panel data each unit is a cluster of multiple time periods.

        Comment


        • #5
          Maarten Loomans An alternative approach would be to combine -xtreg, fe- with -vcemway- where the latter can be downloaded by typing -ssc install vcemway-. The background paper is available here.

          Comment


          • #6
            Originally posted by Maxence Morlet View Post
            1. When you xtset your data, what variable did you employ as x variable? I mean that variable.

            2. 29 clusters (of the [clustvar]) were employed in the analysis. A cluster here means a unit, so in panel data each unit is a cluster of multiple time periods.
            Hi Maxence, I am trying it as we speak. My full model is was:
            xtreg lnreturn Ratdum TAT_Q TAG_Q logTA_Q EBIT_Q ROA_Q FL_Q BTM_Q i.Quarter, cluster(busseccode) fe
            Ratdum is my main var of interest which shows if a firm is rated or not. According to you, I should do the following:
            reghdfe lnreturn Ratdum TAT_Q TAG_Q logTA_Q EBIT_Q ROA_Q FL_Q BTM_Q, absorb(Ratdum Quarter) cluster(busseccode). This, however, omits Ratdum.

            Comment


            • #7
              Are firms rated throughout your sample? If not, for Ratdum not to be omitted, you need to interact it with Quarter.

              And no, what I meant was
              Code:
              reghdfe lnreturn i.Ratdum#i.Quarter TAT_Q TAG_Q logTA_Q EBIT_Q ROA_Q FL_Q BTM_Q, absorb(firmID Quarter) cluster(firmID)
              But this only works if firms do not have a rating throughout your sample, only in certain time periods.

              If not, and you're only interested in Ratdum, you cannot include firm fixed-effects, only industry fixed-effects (I presume busseccode), but your results will no longer be causal...

              Comment


              • #8
                Originally posted by Maxence Morlet View Post
                Are firms rated throughout your sample? If not, for Ratdum not to be omitted, you need to interact it with Quarter.

                And no, what I meant was
                Code:
                reghdfe lnreturn i.Ratdum#i.Quarter TAT_Q TAG_Q logTA_Q EBIT_Q ROA_Q FL_Q BTM_Q, absorb(firmID Quarter) cluster(firmID)
                But this only works if firms do not have a rating throughout your sample, only in certain time periods.

                If not, and you're only interested in Ratdum, you cannot include firm fixed-effects, only industry fixed-effects (I presume busseccode), but your results will no longer be causal...
                Hi Maxence,

                I do not see how not interacting Ratdum with Quarter would lead to Ratdum being omitted. The firms are not always rated fully throughout my sample. Sometimes a firm is first being rated at t = 10, and then from then onwards Ratdum = 1.
                And why does clustering and absorbing only the industry effects lead to my results being not causal? I am sorry if I am asking dumb questions.

                Comment


                • #9
                  I should have edited the first sentence to read: "Are firms rated throughout your sample? If so, for Ratdum not to be omitted, you need to interact it with Quarter."

                  What I meant was that if ratings do not vary within firms, then the variable will be dropped. Try this:

                  Code:
                   
                   reghdfe lnreturn i.Ratdum TAT_Q TAG_Q logTA_Q EBIT_Q ROA_Q FL_Q BTM_Q, absorb(firmID Quarter) cluster(firmID)

                  Comment


                  • #10
                    Originally posted by Maxence Morlet View Post
                    I should have edited the first sentence to read: "Are firms rated throughout your sample? If so, for Ratdum not to be omitted, you need to interact it with Quarter."

                    What I meant was that if ratings do not vary within firms, then the variable will be dropped. Try this:

                    Code:
                    reghdfe lnreturn i.Ratdum TAT_Q TAG_Q logTA_Q EBIT_Q ROA_Q FL_Q BTM_Q, absorb(firmID Quarter) cluster(firmID)
                    Maxence:
                    Thank you! I have one more question. If I see it correctly, this code results in controlling for two fixed effects, but clustering on 1 dimension. I believe I should cluster on more dimensions: industry and Quarter. Please explain to me how my thinking is wrong, because I want to believe you, but I just dont see how

                    Comment


                    • #11
                      this would be a TWFE estimation, indeed controlling for unit and time fixed-effects (hence two way), reviewed in more detail at: https://papers.ssrn.com/sol3/papers....act_id=3906345

                      Code:
                      reghdfe
                      also supports multi-way clustering, what I'm recommending is simply based on hundreds of economic papers I've encountered, I have nothing against multi-way clustering (so unit and time) it's just that I've seldomly seen it be applied.

                      Furthermore, how many firms do you have in your sample? If you have less than 50, then just use
                      Code:
                      vce(robust)
                      and do not cluster, as cluster-robust standard errors will be biased (Cameron and Miller, 2015).

                      Comment


                      • #12
                        Originally posted by Maxence Morlet View Post
                        this would be a TWFE estimation, indeed controlling for unit and time fixed-effects (hence two way), reviewed in more detail at: https://papers.ssrn.com/sol3/papers....act_id=3906345

                        Code:
                        reghdfe
                        also supports multi-way clustering, what I'm recommending is simply based on hundreds of economic papers I've encountered, I have nothing against multi-way clustering (so unit and time) it's just that I've seldomly seen it be applied.

                        Furthermore, how many firms do you have in your sample? If you have less than 50, then just use
                        Code:
                        vce(robust)
                        and do not cluster, as cluster-robust standard errors will be biased (Cameron and Miller, 2015).
                        Maxence:
                        I have found papers that recommend double clustering. And also papers that actually do it. What is the benefit of TWFE as compared to one way FE, or as compared to double clustering.
                        My sample consists of 2300 firms (after cleansing the data), each with 64 observations.

                        Thank you

                        Comment


                        • #13
                          Ok perfect, so you can at least use firms in the clustering.

                          TWFE is not incompatible with two-way clustering, you can introduce unit and time fixed effects in your model and still cluster using firms and months in your case.

                          With TWFE, you are removing any source of bias caused by stochastic, unobservable time shocks (for instance COVID, just as an example). The inlcusion of time fixed-effects is crucial for this reason.

                          Using only unit fixed effects, you will wipe out any unobserved time-invariant heterogeneity, but time shocks that you cannot observe will most likely bias your within estimates (i.e. estimates from fixed-effects estimation).

                          Comment


                          • #14
                            Originally posted by Maxence Morlet View Post
                            Ok perfect, so you can at least use firms in the clustering.

                            TWFE is not incompatible with two-way clustering, you can introduce unit and time fixed effects in your model and still cluster using firms and months in your case.

                            With TWFE, you are removing any source of bias caused by stochastic, unobservable time shocks (for instance COVID, just as an example). The inlcusion of time fixed-effects is crucial for this reason.

                            Using only unit fixed effects, you will wipe out any unobserved time-invariant heterogeneity, but time shocks that you cannot observe will most likely bias your within estimates (i.e. estimates from fixed-effects estimation).
                            Maxence:
                            Thank you.

                            Perhaps a weird question, but right now, I just have xtreg ....., fe ..., how do I know what fixed effects it is controlling for? Because, for example with reghdfe, I have to choose myself what I want to, with lack of better wording, ' use ' as fixed effects.

                            Comment


                            • #15
                              This should replicate the coefficients (by the way the community contributed command reghdfe is available if you type ssc install reghdfe):

                              Code:
                               
                               reghdfe lnreturn i.Ratdum TAT_Q TAG_Q logTA_Q EBIT_Q ROA_Q FL_Q BTM_Q, absorb(firmID Quarter) cluster(firmID)
                              Code:
                               
                               xtreg lnreturn i.Ratdum TAT_Q TAG_Q logTA_Q EBIT_Q ROA_Q FL_Q BTM_Q i.Quarter, fe cluster(firmID)
                              xtreg..., fe alone only includes unit fixed effects, you have to include time FE manually

                              Comment

                              Working...
                              X