Daniel-Pailanir / sdid

Synthetic Difference in Differences for Stata
GNU General Public License v3.0
72 stars 36 forks source link

r(459) error in graph option #54

Open rperezartica opened 1 year ago

rperezartica commented 1 year ago

Hi,

I am running sdid with a panel of 836 units, 127 treated units and a staggered adoption treatment. I made sure no issues with the xtset exist, and the panel is balanced.

xtset idpanel quarter

   panel variable:  idpanel (strongly balanced)
    time variable:  quarter, 2007q1 to 2014q4
            delta:  1 quarter

When running sdid with the graph option the following error comes out:

sdid y idpanel quarter treatment, vce(noinference) graph

    Synthetic Difference-in-Differences Estimator

    y      ATT     Std. Err.     t      P>t    [95% Conf. Interval]
    treatment    0.35794          .        .        .           . .

    95% CIs and p-values are based on Large-Sample approximations.
    Refer to Arkhangelsky et al., (2020) for theoretical derivations.
    variable idpanel does not uniquely identify observations in the using data
    r(459);

Any idea of which is the source of the error and how I can deal with it?

I appreciate your kind help.

Daniel-Pailanir commented 1 year ago

Hi, I assume you are using the github version. I'm going to replicate this data and find the bug, but for now you can solve this by creating another id variable using egen newID = group(idpanel) and run the sdid command with the graph option but with this new id.

rperezartica commented 1 year ago

Hi @Daniel-Pailanir, Yes, I was already using the github version. Thank you very much for your suggestion. I tried it and it worked.

Daniel-Pailanir commented 1 year ago

You're welcome @rperezartica. For the record and future work, what does your idpanel variable look like? numeric? what ranks do you have? Thank you!

rperezartica commented 1 year ago

Hi @Daniel-Pailanir , It was a numeric variable. A codebook of the variable follows

codebook idpanel

      idpanel     (unlabeled)
      type:   numeric (double)

      range:  [2.008e+10,3.456e+10]   units:  1
      unique values:  836 missing .:  0/24,179

      mean:   3.1e+10
      std. dev:   1.4e+09

      percentiles:    10%       25%   50%       75%       90%
           3.1e+10   3.1e+10  3.1e+10   3.1e+10   3.1e+10