bcallaway11 / did

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

Error when Running Att_gt with Panel Data #104

Closed DonQuixote1997 closed 2 years ago

DonQuixote1997 commented 2 years ago

Hello and Happy New Year,

Earlier I was running the code fine with Panel data from 9 states from 2004 to 2019. I increased the data set to all 50 states and from 1999 to 2019 and without changing the code, receive the following error:

Error in BMisc::panel2cs2(disdat, yname, idname, tname, balance_panel = FALSE) : unused argument (balance_panel = FALSE) In addition: Warning message: In pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset. Check groups: 2014,2015,2017,2018.

Line of Code is:

install.packages('did') library(did)

state_data <- read.csv("FinalStateCrimeData.csv", stringsAsFactors=FALSE)

first murderperthousand

Murder_attgt <- att_gt( yname = "Murder", tname = "Year", idname = "Stateid", gname = "first.treat", xformla = ~1, data = state_data) summary(Murder_attgt) ggdid(Murder_attgt)

I checked the data set and there are no duplicate rows. FinalStateCrimeData.csv

bcallaway11 commented 2 years ago

I think you need to update the BMisc package.

I’m almost sure this will fix your problem, but if you continue to have issues, just let me know.

Brant

DonQuixote1997 commented 2 years ago

After updating the package it works now!

Thank you very much.