Announcement

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

  • xtreg: Panels are not nested within clusters

    In a cross section of students, we are running xtreg with school fixed effects and teacher-clustered standard errors. Stata gives the error "panels are not nested within clusters," meaning that schools are not nested within teachers. I understand that schools are not nested within teachers, but I don't see why that should be a problem. Is there something fundamentally wrong with our model, or is it just a model that xtreg is not set up to estimate?

  • #2
    Paul:
    how did you -xtset-your data?
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      This is a good question, I do not have an answer to. Here are some thoughts, anyway.

      Starting from the documentation, it seems the relevant part is

      The cluster–robust–VCE estimator requires that there are many clusters and the disturbances are uncorrelated across the clusters. The panel variable must be nested within the cluster variable because of the within-panel correlation induced by the within transform.
      I understand the first sentence to mean, that there might be a problem in your set up, because using teachers as clusters you assume no correlation between their disturbances. Yet, for any teachers being in the same school, it seems likely that there is some sort of correlation. The second sentence states that the within transformation applied to the data, mechanically produces intra-panel correlation.

      More insight might be gained if one further thinks about the three-level structure that you have (pupils nested in teachers nested in schools, presumably), but try to model with a tool that is basically limited to two levels. I am not quite sure which of the three error components are corrected with the vce(cluster clustervar) option?

      If the nesting in your data is as I assume (i.e., students - teachers - schools), might I ask for any specific reason not to cluster at the highest level (schools)? If you are worried about a (very) low number of schools, you might want to think about demeanig the data at the teacher level and add a few school indicator variables, thus controlling for school fixed-effects explicitly using the LSDV approach.

      You may find this presentation useful, and might want to look into xtivreg2 (SSC) - even if you do plan on IV estimation.

      Best
      Daniel

      Comment


      • #4
        the above are good points; I also note that if teachers are not nested in schools (happens in many districts in the US esp. for specialized teachers), then you probably have a crossed design and want mixed rather than xtreg

        Comment


        • #5
          I have a similar problem with a panel of students over multiple years. I cluster my standard errors at the county level as that is the level of policy variation I can observe. Stata give error message "panels are not nested within clusters" . If I take over the students who have ever moved I solve my problem. But that changes the meaning of my estimates, introduces bias. Is this the problem - the fact that I have individuals who over the course of the panel moved to a different county?

          Comment

          Working...
          X