Announcement

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

  • double clustering error: panels are not nested within clusters

    Hi,

    I am running a panel regression (xtreg) with a DiD variables and fixed effects (time and individual). I cluster my errors with on country level. I do not have any issue in this first model.

    However, I would like to conduct an additional analysis with a double-clustering method. For this purpose, I have successfully created a new variable with the following command:

    gen double_cluster=group(country_id qdate)
    qdate: is my quarterly time that I have used when setting my panel (2011q1, 20111q2 ...)

    I run my model - xtreg, fe vce(cluster double_cluster) and received an error called "panels are not nested within clusters".

    I tried to tackle this issue by creating a new time variable called time_id. For instance, my initial date 2011q1 becomes 1 for every country, 2011q2 becomes 2 and so on.Then, I create a new double_cluster variable and run my model. Nevertheless, the issue persists.

    I follow the recommended approach mentioned in this thread to examine if there is an error in my data:
    by country_id, sort: gen byte moved = (country_id [1] != country_id [_N])
    browse if moved

    The prompting Data Browser is empty, suggesting me that there is no issue in my data. (?)

    So, I decided to open this thread and ask for your recommendations.


  • #2
    HTML Code:
    https://www.statalist.org/forums/forum/general-stata-discussion/general/1494694-panels-are-not-nested-within-clusters
    use reghdfe to cluster by more than one variable.

    Comment


    • #3
      Originally posted by George Ford View Post
      HTML Code:
      https://www.statalist.org/forums/forum/general-stata-discussion/general/1494694-panels-are-not-nested-within-clusters
      use reghdfe to cluster by more than one variable.
      I ran and obtained some results. However, there is a warning before the results:

      Warning: VCV matrix was non-positive semi-definite; adjustment from Cameron, Gelbach & Miller applied.
      warning: missing F statistic; dropped variables due to collinearity or too few clusters


      Should I be worried?

      Comment


      • #4
        Yes, be worried. You've got something in your data that is playing nice with your model.

        Comment


        • #5
          Originally posted by George Ford View Post
          Yes, be worried. You've got something in your data that is playing nice with your model.
          How can I identify this?

          Comment


          • #6
            Maybe not that bad, but need to check a few things.
            HTML Code:
            https://www.statalist.org/forums/forum/general-stata-discussion/general/1591280-regdhfe-and-warning-adjustment-from-cameron-gelbach-miller-applied

            Comment

            Working...
            X