Announcement

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

  • Difference vce(cluster id) - vce(robust)

    Dear Statalists,

    As I mentioned in the title:

    What is the difference between using the command vce(cluster id) or the command vce(robust) in an xtreg regression model?
    I often read it is the same, although after trying on my dataset I noticed slight changes.

    As always I would like to thank you in advance

    Loris

  • #2
    If you are using -xtreg, fe-, then they are the same. If you specify -xtreg, fe vce(robust)-, Stata re-interprets that to -xtreg, fe vce(cluster panelvar)-. With other commands, in general, they are different. The -vce(robust)- requires that observations be independent in order for it to be valid, whereas -vce(cluster groupvar)- accommodates and adjusts for correlation of observations within values of groupvar. If you want more detail, I suggest reading "Obtaining robust variance estimates" in section 20.21 of [U].

    Comment


    • #3
      Now it's all clear. Thank you for your help.
      Still I have another question specific to my dataset if you will be so kind:
      If my analysis is performed at the municipal level (ca. 1400 Municipalities), should I cluster at the municipal level or is it reccomendable to do so with a bit larger cluster groups (like provinces for example)?

      Comment


      • #4
        Well, it all boils down to whether observations within municipalities can be considered independent. So it depends on the variables you are analyzing. If observations from the same municipality are likely to be more similar than observations from different municipalities, then you need to cluster at the municipality level to account for this. If, however, the variable is one that municipalities have no real influence on, but provinces do, then you would cluster at the province level.

        I would say that, all else equal, one would start by assuming that there is real clustering at the municipality level. You can run your analyses that way. If you are using, say -xtreg-, at the end of your output you will see a test of the hypothesis that all u_i = 0. That is a test for clustering. If the test suggests that clustering really isn't there (The F test is not significant and the sigma_u value is small), then you could re-do things with clustering at the provincial level. That doesn't happen often, but sometimes it does. But if the test finds important municipal clustering, then you must keep your clustering at the municipal level.

        Comment


        • #5
          You are as always great help Clyde. Wish you a lovely weekend

          Comment


          • #6
            Originally posted by Clyde Schechter View Post
            Well, it all boils down to whether observations within municipalities can be considered independent. So it depends on the variables you are analyzing. If observations from the same municipality are likely to be more similar than observations from different municipalities, then you need to cluster at the municipality level to account for this. If, however, the variable is one that municipalities have no real influence on, but provinces do, then you would cluster at the province level.

            I would say that, all else equal, one would start by assuming that there is real clustering at the municipality level. You can run your analyses that way. If you are using, say -xtreg-, at the end of your output you will see a test of the hypothesis that all u_i = 0. That is a test for clustering. If the test suggests that clustering really isn't there (The F test is not significant and the sigma_u value is small), then you could re-do things with clustering at the provincial level. That doesn't happen often, but sometimes it does. But if the test finds important municipal clustering, then you must keep your clustering at the municipal level.
            Dear Clyde, I have a similar question but for a random effects model (based on Hausman's test). My clustering variable is company id. But in random effects we assume corr(u,x) = 0 and don't get the u_i test values as in the Fe model. In such a case, how to justify use of vce (cluster) over vce (robust). Also, does this depend on the number of periods in a panel data, say, a 3-year data versus a 10-year data. Thanks.
            Last edited by Nitin Jain; 19 Apr 2024, 15:38.

            Comment


            • #7
              The use of clustering has nothing to do with corr(u, x). It has to do with the within-cluster correlations of the e's among themselves. You will actually get an estimate of that in the -xtreg, re- output. At the very bottom of the regression table you will see the estimate of parameter rho, the intraclass correlation. Unless rho is extremely close to, or equals, 0, you have within-cluster correlation. Of course, there is also the issue of the number of clusters in your data. Clustered VCEs are asymptotically correct, meaning that they work well in large samples. They perform very poorly in small ones. There is no hard and fast rule of thumb about how large is large enough, but if you have fewer than 10 clusters, you definitely shouldn't use them. And they sometimes perform poorly even with 30 or 50 clusters.

              Comment


              • #8
                Originally posted by Clyde Schechter View Post
                The use of clustering has nothing to do with corr(u, x). It has to do with the within-cluster correlations of the e's among themselves. You will actually get an estimate of that in the -xtreg, re- output. At the very bottom of the regression table you will see the estimate of parameter rho, the intraclass correlation. Unless rho is extremely close to, or equals, 0, you have within-cluster correlation. Of course, there is also the issue of the number of clusters in your data. Clustered VCEs are asymptotically correct, meaning that they work well in large samples. They perform very poorly in small ones. There is no hard and fast rule of thumb about how large is large enough, but if you have fewer than 10 clusters, you definitely shouldn't use them. And they sometimes perform poorly even with 30 or 50 clusters.
                Dear Clyde, Thank you. This is what I get in the output, apart from the beta estimates. So, rho = 0.5 indicates it is fine to cluster via company id.

                Random-effects GLS regression
                Number of obs = 3,465
                Group variable: id
                Number of groups = 271

                R-squared: Obs per group:
                Within = 0.0169 min = 1
                Between = 0.3009 avg = 12.8
                Overall = 0.2000 max = 14

                Wald chi2(35) = 266.00
                corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

                (Std. err. adjusted for 271 clusters in id)



                ----------Beta estimates table

                -------------------------------+----------------------------------------------------------------
                sigma_u | .68284582
                sigma_e | .6785386
                rho | .50316382 (fraction of variance due to u_i)
                --------------------------------------------------------------------------------------------------

                Comment

                Working...
                X