Announcement

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

  • Double Clustering with CSDID and did_multiplegt_dyn

    Dear all,
    I am currently running a DiD set-up on panel data.
    The panel is made of school (PC) and years. I would like to have an iteration with errors clustered at the school level, and one with errors clustered at the school-year level.

    My understanding is that with CSDiD when Panel estimators are used,standard errors are already clustered at the panel level. Does it make the use of "cluster(pc)" (please see code below) superfluous?
    Further, the help file says " When using cluster, one is effectively requesting a two-way cluster estimation." However when I call for "cluster(year)" it also does not run.

    Specifically:

    Code:
    xtset pc year 
    
    csdid log_grade, ivar(pc) time(year) gvar(year_of_treat)   ## This runs
    
    csdid log_grade, ivar(pc) time(year) gvar(year_of_treat)   cluster(pc) ## This gives the following error: pc may not be both target and by() r(198);
    
    csdid log_grade , ivar(pc) time(year) gvar(year_of_treat)   cluster(year) ## This gives the following error: panels are not nested within clusters r(498);
    
    did_multiplegt_dyn log_grades pc year iv, effects(8) placebo(5) cluster(pc) ## This runs
    
    xtset pc year
    egen double_cluster=group(pc year)
    
    did_multiplegt_dyn log_grades pc year iv, effects(8) placebo(5) cluster(double_cluster) ## This doesn't run: "The group variable should be nested within the clustering variable."
    I am not sure what I am doing wrong or if it is at all possible to have a double clustering with CSDID or did_multiplegt_dyn. Could someone help me?
    Thank you very much in advance!
    Best,

    Ludovica

  • #2
    short answer
    csdid with panel data clusters at the Ivar level. Using cluster(ivar) is not possible nor will it make any sense
    Now other clustering has to be at a higher level that ivar is nested to
    for example, if your ivar are schools, you could cluster by district, because schools will be nested within district
    Other types of clustering with csdid is not possible.

    Comment


    • #3
      Hi Fernando,
      Thanks.
      I understand why I cannot go to a more disaggregated level than the id, however I am unsure of why double clustering - so cluster(tvar) - doesn't work, as it is usually possible within panel data.
      Is it because the id-year is considered more disaggreated?
      Any intuition would really help me, thank you again!

      Comment


      • #4
        Its a technical detail
        when using panel data estimators, the influence function is collapsed so each row its a panel unit and each column a ATTGT (time x cohort)
        in this structure, you can only CLUSTER using groups of panel units. Not time

        Comment

        Working...
        X