d2cml-ai / csdid

CSDID
https://d2cml-ai.github.io/csdid/index.html
MIT License
14 stars 4 forks source link

Code error when using not yet treated as controls #18

Open dadepro opened 9 months ago

dadepro commented 9 months ago

When I estimate the aggregated ATE using employment rate data and change the control group to notyettreated, the code gives an error:

import pandas as pd
from csdid.att_gt import ATTgt

 data = pd.read_csv("https://raw.githubusercontent.com/d2cml-ai/csdid/function-aggte/data/mpdta.csv")
 out = ATTgt(yname = "lemp",
              gname = "first.treat",
              idname = "countyreal",
              tname = "year",
              xformla = f"lemp~1",
              control_group = "notyettreated",
              data = data,
              ).fit(est_method = 'dr')
out.aggte(typec='simple')

Error:

compute_att_gt.py", line 83, in compute_att_gt
    n3 = np.where(data[gname] != glist[g], True, False)
IndexError: index 2004 is out of bounds for axis 0 with size 3`