bcallaway11 / did

Difference in Differences with Multiple Periods, website: https://bcallaway11.github.io/did
288 stars 92 forks source link

Nested unbalanced panel data #138

Open ariaudisio opened 2 years ago

ariaudisio commented 2 years ago

I have an unbalanced panel of student data, where students are nested within teachers and teachers are nested within schools. The treatment (a teacher profesional development program) is at the teacher level and we have 3 cohorts of teachers and 5 years of data (2 pre-treatment years). Can I use did with this type of data and treatment?

I was able to run the code and get results with allow_unbalanced_panel = FALSE. If I set it to TRUE I get the following error:

Error in aggregate.data.frame(as.data.frame(x), ...) : arguments must have same length

And, when I try to cluster by school I get this error:

Error in mboot(inffunc, DIDparams = dp) : can't handle time-varying cluster variables In addition: Warning message: In pre_process_did(yname = yname, tname = tname, idname = idname, : Dropped 23049 observations while converting to balanced panel.

Thanks!