ebenmichael / augsynth

Augmented Synthetic Control Method
MIT License
148 stars 52 forks source link

Error: Each row of output must be identified by a unique combination of keys. #48

Closed Asymmetric-policy-impact closed 3 years ago

Asymmetric-policy-impact commented 3 years ago

Hi Eli, I'm seeing the below error and don't know if there's a workaround. Earlier while running a different equation I was seeing "Keys are shared for 192 rows". I've checked my df, and as you can see the following sample rows are different. I even tried to delete rows, but still kept getting the error. Grateful for your assistance.

image image

ppool_syn <- multisynth(spend_all ~ treat_post, statefips, time,

  • nu = 0.5, data, n_leads = 10) Error: Each row of output must be identified by a unique combination of keys. Keys are shared for 1098 rows:
  • 1099, 1648
  • 1282, 1831
  • 1465, 2014
  • 1100, 1649
  • 1283, 1832
  • 1466, 2015
  • 1101, 1650
  • 1284, 1833
  • 1467, 2016
  • 1102, 1651
  • 1285, 1834
  • 1468, 2017
  • 1103, 1652
  • 1286, 1835
  • 1469, 2018
  • 1104, 1653
  • 1287, 1836
  • 1470, 2019
  • 1105, 1654
  • 1288, 1837
  • 1471, 2020
  • 1106, 1655
  • 1289, 1838
  • 1472, 2021
  • 1107, 1656
  • 1290, 1839
  • 1473, 2022
  • 1108, 1657
  • 1291, 1840
  • 1474, 2023
  • 1109, 1658
  • 1292, 1841
  • 1475, 2024
  • 1110, 1659
  • 1293, 1842
  • 1476, 2025
  • 1111, 1660
  • 1294, 1843
  • 1477, 2026
  • 1112, 1661
  • 1295, 1844
  • 1478, 2027
  • 1113, 1662
  • 1296, 1845
  • 1479, 2028
  • 1114, 1663
  • 1297, 1846
  • 1480, 2029
  • 1115, 1664
  • 1298, 1847
  • 1481, 2030
  • 1116, 1665
  • 1299, 1848
  • 1482, 2031
  • 1117, 1666
  • 1300, 1849
  • 1483, 2032
  • 1118, 1667
  • 1301, 1850
  • 1484, 2033
  • 1119, 1668
  • 1302, 1851
  • 1485, 2034
  • 1120, 1669
  • 1303, 1852
  • 1486, 2035
  • 1121, 1670
  • 1304, 1853
  • 1487
ebenmichael commented 3 years ago

This probably has to do with some duplicates on statefips and time, are you sure that there are no rows with the same values of those two variables?

Asymmetric-policy-impact commented 3 years ago

Thanks Eli, looks like things are working now! Appreciate it. However, it didn't have to do with duplicates. Don't know what happened, but the same lines of code work now!

loikein commented 5 months ago

Hi, I had this exact same error as well when trying to run a staggered adoption specification.

I have used the same dataset to run other packages previously with no issues, and have double checked that the rows in the error message contains no duplicated (unit,time) pairs. I wonder if there is anything you would suggest that I try to workaround this? Thanks a lot.