Announcement

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

  • Missing standard errors when running 2D cluster with fixed effects

    Hi,

    I'm trying to run a regression on panel data with standard errors robust at both the cross sectional and time levels, as well as fixed effects either at the cross sectional or time level. Number of cross sections is 708 while number of time series is 63. The problem I encounter is that in the results, the standard errors are missing for one of the explanatory variables, and some of the dummy variables.

    I checked the cross sectional dummy variables, and found that for some identifiers, there is only 1 observation. I guess that is the problem? In that case I guess the solution would be to remove those identifiers? How about those identifiers with 2 observations? or 3? ... 10? What would be considered as too few observations?

    I also checked the time series dummy variables, and found that the minimum number of observations for any time period was 248. However, when I run the regression with time fixed effects, the standard errors are also missing for the same explanatory variable and for some of the time dummy variables.

    Does anyone have any advice regarding this?

    I'm using the 2D cluster macro from Michell Peterson's page: http://www.kellogg.northwestern.edu/...e/cluster2.ado
    The command I run is:
    - Time fixed effects: xi: cluster2 srisk lev m2b biz eqtyvol lagsrisk lagvar size i.date, fcluster(permco) tcluster(date)
    - Cross section effects: xi: cluster2 srisk lev m2b biz eqtyvol lagsrisk lagvar size i.permco, fcluster(permco) tcluster(date)

    Thank you!

  • #2
    Rardical (please, as per FAQ, re-register with your real name and surname. It is easy to do: just click on the Contact us button at bottom right of the screen):
    - to increase the chance to get helpful replies, please report exactly what you typed and what Stata gave you back (again, as per FAQ).

    Kind regards,
    Carlo
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Thanks Carlo. I have re-registered through "contact us".

      Attached below is the command I gave and the results that were given for time fixed effects. I am using Stata 11.0.

      Thank you in advance for any advise you may have!
      Gerard


      . xi: cluster2 srisk lev m2b biz eqtyvol lagsrisk lagvar size i.date, fcluster(permco) tcluster(date)
      i.date _Idate_13240-18901 (naturally coded; _Idate_13240 omitted)

      Linear regression with 2D clustered SEs Number of obs = 22667
      F( 69, 22590) = 1385.23
      Prob > F = 0.0000
      Number of clusters (permco) = 708 R-squared = 0.9026
      Number of clusters (date) = 63 Root MSE = 9.2197
      ------------------------------------------------------------------------------
      srisk | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      lev | .0426975 .0334994 1.27 0.202 -.0229637 .1083586
      m2b | -.2057284 .2834639 -0.73 0.468 -.7613371 .3498804
      biz | -.0270466 . . . . .
      eqtyvol | -28.39841 22.74137 -1.25 0.212 -72.97307 16.17625
      lagadcovar | .9189135 .049564 18.54 0.000 .8217647 1.016062
      lagvar | -4.308709 1.125219 -3.83 0.000 -6.514216 -2.103202
      size | -.832574 .2530488 -3.29 0.001 -1.328567 -.3365809
      _Idate_13331 | 1.160758 .0828846 14.00 0.000 .998299 1.323218
      _Idate_13423 | -1.045512 .0759415 -13.77 0.000 -1.194363 -.8966618
      _Idate_13515 | -.6793042 . . . . .
      _Idate_13605 | -2.192859 . . . . .
      _Idate_13696 | -1.13372 .2058256 -5.51 0.000 -1.537152 -.7302873
      _Idate_13788 | -4.0568 .2235777 -18.14 0.000 -4.495027 -3.618572
      _Idate_13880 | 3.35301 .3582575 9.36 0.000 2.650801 4.055219
      _Idate_13970 | -1.57945 .1956287 -8.07 0.000 -1.962895 -1.196004
      _Idate_14061 | -8.083051 .2596378 -31.13 0.000 -8.591959 -7.574143
      _Idate_14153 | -10.58501 .5233633 -20.22 0.000 -11.61084 -9.55918
      _Idate_14245 | 8.324765 .7732429 10.77 0.000 6.809155 9.840374
      _Idate_14335 | -1.547293 .3270573 -4.73 0.000 -2.188348 -.9062382
      _Idate_14426 | -1.828381 .3515238 -5.20 0.000 -2.517392 -1.139371
      _Idate_14518 | -7.092631 .3817948 -18.58 0.000 -7.840975 -6.344287
      _Idate_14610 | 6.925146 .5832976 11.87 0.000 5.781842 8.068449
      _Idate_14701 | -7.690809 .4280369 -17.97 0.000 -8.52979 -6.851827
      _Idate_14792 | 4.001874 .5788954 6.91 0.000 2.867199 5.136549
      _Idate_14884 | -5.528018 .3339012 -16.56 0.000 -6.182487 -4.873548
      _Idate_14976 | -1.306446 .4809224 -2.72 0.007 -2.249087 -.3638049
      _Idate_15066 | -1.777292 .3972615 -4.47 0.000 -2.555952 -.9986323
      _Idate_15157 | -.8446191 .4524442 -1.87 0.062 -1.731441 .0422028
      _Idate_15249 | -4.232907 .4107535 -10.31 0.000 -5.038012 -3.427802
      _Idate_15341 | 3.973299 .5616421 7.07 0.000 2.872441 5.074156
      _Idate_15431 | -1.616915 .3254214 -4.97 0.000 -2.254763 -.9790666
      _Idate_15522 | -9.759759 .3366511 -28.99 0.000 -10.41962 -9.099899
      _Idate_15614 | -2.343591 .6653443 -3.52 0.000 -3.647712 -1.03947
      _Idate_15706 | -.4063885 .6365388 -0.64 0.523 -1.654049 .8412715
      _Idate_15796 | 4.61224 .5212039 8.85 0.000 3.590645 5.633836
      _Idate_15887 | 2.029771 .2685674 7.56 0.000 1.50336 2.556182
      _Idate_15979 | 1.114008 .2039431 5.46 0.000 .7142656 1.513751
      _Idate_16071 | .4029356 .1235965 3.26 0.001 .1606781 .6451932
      _Idate_16162 | 2.335002 .2050838 11.39 0.000 1.933024 2.736981
      _Idate_16253 | .5106732 .2030026 2.52 0.012 .1127741 .9085723
      _Idate_16345 | -.8383145 .2178346 -3.85 0.000 -1.265285 -.4113437
      _Idate_16437 | 6.894132 .2223499 31.01 0.000 6.458311 7.329953
      _Idate_16527 | -1.308817 .3374249 -3.88 0.000 -1.970193 -.6474404
      _Idate_16618 | .1594213 .2375799 0.67 0.502 -.3062517 .6250943
      _Idate_16710 | .2430004 .2149458 1.13 0.258 -.1783081 .664309
      _Idate_16802 | 2.55948 .2314226 11.06 0.000 2.105876 3.013084
      _Idate_16892 | -2.333713 .2239879 -10.42 0.000 -2.772745 -1.894681
      _Idate_16983 | 1.351142 .2311713 5.84 0.000 .8980305 1.804254
      _Idate_17075 | 3.556387 .2435086 14.60 0.000 3.079094 4.033681
      _Idate_17167 | .5898686 .2506654 2.35 0.019 .0985472 1.08119
      _Idate_17257 | -3.810494 .1325499 -28.75 0.000 -4.070301 -3.550687
      _Idate_17348 | -13.85112 . . . . .
      _Idate_17440 | -9.020211 .738431 -12.22 0.000 -10.46759 -7.572836
      _Idate_17532 | -10.97718 1.021734 -10.74 0.000 -12.97984 -8.974506
      _Idate_17623 | -5.353302 1.293743 -4.14 0.000 -7.889127 -2.817477
      _Idate_17714 | -7.307041 1.268763 -5.76 0.000 -9.793903 -4.820178
      _Idate_17806 | -58.96937 1.946644 -30.29 0.000 -62.78492 -55.15381
      _Idate_17898 | 12.70691 3.669006 3.46 0.001 5.515407 19.89842
      _Idate_17988 | 4.245108 2.738169 1.55 0.121 -1.121892 9.612107
      _Idate_18079 | 17.55708 2.12323 8.27 0.000 13.3954 21.71876
      _Idate_18171 | -1.303713 1.110467 -1.17 0.240 -3.480305 .8728795
      _Idate_18263 | 7.395439 1.059989 6.98 0.000 5.317788 9.473089
      _Idate_18353 | -8.367783 .7619347 -10.98 0.000 -9.861228 -6.874338
      _Idate_18444 | -.5266356 1.108502 -0.48 0.635 -2.699376 1.646105
      _Idate_18536 | -4.034235 .9271854 -4.35 0.000 -5.851582 -2.216887
      _Idate_18628 | 5.302891 .9114865 5.82 0.000 3.516315 7.089468
      _Idate_18718 | -.7909584 .6893094 -1.15 0.251 -2.142052 .5601355
      _Idate_18809 | -15.39297 .7185519 -21.42 0.000 -16.80138 -13.98456
      _Idate_18901 | -4.092057 1.315012 -3.11 0.002 -6.669572 -1.514542
      _cons | -4.21565 1.020797 -4.13 0.000 -6.216484 -2.214817
      ------------------------------------------------------------------------------

      SE clustered by permco and date

      Comment


      • #4
        In fact, none of the standard errors on the time dummies can be trusted. The same is true if you were displaying the estimates on the cross-sectional fixed effects. If you want to see things blow up, estimate the equation with only the cross section and time fixed effects.

        The problem also arises if you try to obtain standard errors of the cross section fixed effects when clustering at the cross section level. In effect, you are trying to compute a standard error for a sample average without putting any restrictions on the time series correlation. As time series people will tell you, this is impossible. Regrettably, this discussion did not make it into the second edition of my MIT Press book, "Econometric Analysis of Cross Section and Panel Data." It is in the slides that I use for the course. The two-way clustering is doing the same thing, and also trying to obtain a standard error for the time effects by allowing any correlation in the cross section dimension. The only reason you get numbers at all is because of the other covariates in the equation.

        For a simple demonstration of the problem, use the command

        reg srisk i.date, cluster(date)

        and you will see standard errors essentially zero.

        The only mystery is why the standard error on biz is not reported. You could try deviating the data from the cross sectional averages for each time period so that time effects are no longer needed in the cluster2 command. I'm not terribly optimistic, though. I suspect there is some special feature of the variation in biz that is causing the problem. JW

        Comment


        • #5
          Thank you very much for your advice Jeff!

          I understand your point that the standard errors for the dummies are not accurate. Fortunately, I'm more concerned about controlling for fixed effects than the standard errors of the dummies.

          I think the problem of the missing standard error on biz is because its corresponding element in the V[β] matrix is negative (-0.00031). This problem is mentioned in http://www.econ.ucdavis.edu/faculty/...009version.pdf pg 11 3rd paragraph.

          What do you think?

          I'm now searching if anyone has coded the proposed solution of converting the negative eigenvalue to 0 (the above link pg 11 4th paragraph). If not, I'll probably code it myself.

          Comment


          • #6
            ivreg2 supports linear regression with 2-way clustering - the syntax in your case would be cluster(permco date). It might also be able to help with your missing SEs, in 2 ways. First, you can use the partial(.) option to partial out all the dummies (this is basically Jeff's suggestion above). Second, there are 2 (undocumented) options for dealing with the negative eigenvalue problem: psd0 replaces a negative eigenvalue with 0, whereas psda replaces it with its absolute value. (Whether either of these eigenvalue fixes is a good idea in your case is your call!)

            Comment


            • #7
              Dear Mark

              I have the same issue regarding the missing standard errors when using cluster2 command.

              However following your suggestions, I have a couple of queries. Firstly, what is the difference between ivreg2 and cluster2 commands?

              Secondly, psd0 and psda, could you please provide any references here?

              Best regards

              Yahya

              Comment


              • #8
                Dear Yahya,

                I recall the Cameron et al papers for multi-way clustering had a discussion on the psd0/psda solutions.

                About the difference between both commands, I would just go with ivreg2's version as it is more modern/flexible. At some point I also wrote my own implementation of multi-way clustering ( https://github.com/sergiocorreia/reg...rapper_mwc.ado ) and ivreg2 gave me the same results.

                Best,
                Sergio

                Comment


                • #9
                  Dear Sergio

                  Thank you for this.

                  Comment

                  Working...
                  X