{
  "_id": "6a227fb9cd65a98ecbd5101f",
  "Package": "synthdid",
  "Title": "Synthetic Difference-in-Difference Estimation",
  "Version": "0.0.9",
  "Author": "Dmitry Arkhangelsky [aut] Susan Athey [aut] David A. Hirshberg\n[aut, cre] Guido W. Imbens [aut] Stefan Wager [aut]",
  "Maintainer": "David A. Hirshberg <david.a.hirshberg@gmail.com>",
  "Description": "Estimate average treatment effects in panel data.\nCurrently provides methods only for the case that all treated\nunits adopt treatment at the same time.",
  "License": "GPL (>= 2) | BSD_3_clause + file LICENSE",
  "Encoding": "UTF-8",
  "LazyData": "true",
  "Roxygen": "list(markdown = TRUE)",
  "RoxygenNote": "7.1.1",
  "URL": "https://github.com/synth-inference/synthdid",
  "BugReports": "https://github.com/synth-inference/synthdid/issues",
  "Repository": "https://skranz.r-universe.dev",
  "Date/Publication": "2021-07-09 13:54:56 UTC",
  "RemoteUrl": "https://github.com/skranz/synthdid",
  "RemoteRef": "master",
  "RemoteSha": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
  "NeedsCompilation": "no",
  "Packaged": {
    "Date": "2026-06-05 07:31:53 UTC",
    "User": "root"
  },
  "MD5sum": "9b5e9b89df5f2cce171a3f32e6c46cf6",
  "_user": "skranz",
  "_type": "src",
  "_file": "synthdid_0.0.9.tar.gz",
  "_fileid": "db967391ae4cb72ba050c76888666d720a40b101dc82d5f52435e018d4401954",
  "_filesize": 273714,
  "_sha256": "db967391ae4cb72ba050c76888666d720a40b101dc82d5f52435e018d4401954",
  "_created": "2026-06-05T07:31:53.000Z",
  "_published": "2026-06-05T07:50:17.567Z",
  "_distro": "noble",
  "_jobs": [
    {
      "job": 79683958833,
      "time": 788,
      "config": "linux-devel-x86_64",
      "r": "4.7.0",
      "check": "ERROR",
      "artifact": "7431413601"
    },
    {
      "job": 79683958820,
      "time": 749,
      "config": "linux-release-x86_64",
      "r": "4.6.0",
      "check": "ERROR",
      "artifact": "7431401927"
    },
    {
      "job": 79683958855,
      "time": 649,
      "config": "macos-oldrel-arm64",
      "r": "4.5.3",
      "check": "ERROR",
      "artifact": "7431500731"
    },
    {
      "job": 79683958821,
      "time": 703,
      "config": "macos-release-arm64",
      "r": "4.6.0",
      "check": "ERROR",
      "artifact": "7431416972"
    },
    {
      "job": 79683578457,
      "time": 162,
      "config": "source",
      "r": "4.6.0",
      "check": "OK",
      "artifact": "7431180212"
    },
    {
      "job": 79683958832,
      "time": 103,
      "config": "wasm-release",
      "r": "4.6.0",
      "check": "OK",
      "artifact": "7431211510"
    },
    {
      "job": 79683958986,
      "time": 734,
      "config": "windows-devel",
      "r": "4.7.0",
      "check": "ERROR",
      "artifact": "7431397184"
    },
    {
      "job": 79683958838,
      "time": 740,
      "config": "windows-oldrel",
      "r": "4.5.3",
      "check": "ERROR",
      "artifact": "7431398945"
    },
    {
      "job": 79683958831,
      "time": 738,
      "config": "windows-release",
      "r": "4.6.0",
      "check": "ERROR",
      "artifact": "7431398523"
    }
  ],
  "_buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618",
  "_status": "success",
  "_host": "GitHub-Actions",
  "_upstream": "https://github.com/skranz/synthdid",
  "_commit": {
    "id": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
    "author": "davidahirshberg <david.a.hirshberg@gmail.com>",
    "committer": "GitHub <noreply@github.com>",
    "message": "Paper experiments (#65)\n\n* updated random low rank to not have ordered units\r\n\r\n* fixed bug in README code\r\n\r\n* update synthdid_plot so it shows faint arrows indicating upper and lower\r\nbounds for a 95% CI for the treatment effect\r\n\r\n* fixed roxygen warning in synthdid_units_plot\r\n\r\n* fixed man issues in synthdid_plot\r\n\r\n* updated developing\r\n\r\n* added reference solver in CVXR and tests that our implementation agrees with it on california data.\r\nTODO: better stopping rule for optimizers, ideally one based on a tolerance for the convergence of the SDID estimate.\r\n\r\n* removed test that nothing had changed. redundant given test against\r\nreference implementation\r\n\r\n* modified standard error estimators to be faithful to the paper and\r\nreplicate all options of the call, e.g. stopping rule parameters, when\r\nresampling\r\n\r\n* move all standard error code to vcov.R; export synthdid_se again, marked\r\ndeprecated in docs\r\n\r\n* added missing man file\r\n\r\n* add CVXR for testing on azure\r\n\r\n* add penn/cps\r\n\r\n* tests fail on azure possibly  due to hardware/linking issue. Try using ubuntu instead of osx.\r\n\r\n* stata -> state\r\n\r\n* try macOS with source install of CVXR\r\n\r\n* added preliminary version of simulations from paper. Resolve: there seem to be\r\nsome differences between the data used here and the data used in\r\nDmitry's simulations.\r\n\r\n* fixed bug in which penn data was loaded sorted-by-treatment, which\r\nbroke treatment/unit correspondence\r\n\r\n* parallelized sims + added coverage sims,\r\nadded a script (package-data.R) that saves the correctly formatted CPS and PENN csv files,\r\nand added those now seemingly correct generated csv files\r\n\r\n* added high-regularization sdid variant to sims + more idiomatic use of\r\ndoParallel\r\n\r\n* disable testthat tests against reference unit we can get CVXR working on\r\nazure\r\n\r\n* for bootstrap variance estimators, multiply var(samples) by\r\n(#samples-1)/#samples to compensate for 1/(#samples - 1) normalization\r\nin R's var\r\n\r\n* added: save simulation output ",
    "time": 1625838896
  },
  "_maintainer": {
    "name": "David A. Hirshberg",
    "email": "david.a.hirshberg@gmail.com",
    "login": "davidahirshberg",
    "description": "",
    "uuid": 1794012
  },
  "_registered": true,
  "_dependencies": [
    {
      "package": "R",
      "version": ">= 3.4",
      "role": "Depends"
    },
    {
      "package": "mvtnorm",
      "role": "Imports"
    },
    {
      "package": "testthat",
      "role": "Suggests"
    },
    {
      "package": "ggplot2",
      "role": "Suggests"
    },
    {
      "package": "CVXR",
      "role": "Suggests"
    }
  ],
  "_owner": "skranz",
  "_selfowned": true,
  "_usedby": 1,
  "_updates": [],
  "_tags": [],
  "_stars": 0,
  "_contributors": [
    {
      "user": "davidahirshberg",
      "count": 82,
      "uuid": 1794012
    },
    {
      "user": "erikcs",
      "count": 35,
      "uuid": 7185264
    },
    {
      "user": "swager",
      "count": 6,
      "uuid": 1275702
    }
  ],
  "_userbio": {
    "uuid": 1413022,
    "type": "user",
    "name": "Sebastian Kranz"
  },
  "_downloads": {
    "count": 0,
    "source": "https://cranlogs.r-pkg.org/downloads/total/last-month/synthdid"
  },
  "_devurl": "https://github.com/synth-inference/synthdid",
  "_searchresults": 183,
  "_rbuild": "4.6.0",
  "_assets": [
    "extra/citation.cff",
    "extra/citation.html",
    "extra/citation.json",
    "extra/citation.txt",
    "extra/contents.json",
    "extra/readme.html",
    "extra/readme.md",
    "extra/synthdid.html",
    "manual.pdf"
  ],
  "_cranurl": false,
  "_exports": [
    "did_estimate",
    "estimate_dgp",
    "lindsey_density_estimate",
    "panel.matrices",
    "sc_estimate",
    "simulate_dgp",
    "synthdid_controls",
    "synthdid_effect_curve",
    "synthdid_estimate",
    "synthdid_placebo",
    "synthdid_placebo_plot",
    "synthdid_plot",
    "synthdid_rmse_plot",
    "synthdid_se",
    "synthdid_units_plot",
    "timesteps"
  ],
  "_datasets": [
    {
      "name": "california_prop99",
      "title": "California proposition 99",
      "object": "california_prop99",
      "class": [
        "data.frame"
      ],
      "fields": [
        "State",
        "Year",
        "PacksPerCapita",
        "treated"
      ],
      "rows": 1209,
      "table": true,
      "tojson": true
    },
    {
      "name": "CPS",
      "title": "CPS",
      "object": "CPS",
      "class": [
        "data.frame"
      ],
      "fields": [
        "state",
        "year",
        "log_wage",
        "hours",
        "urate",
        "min_wage",
        "open_carry",
        "abort_ban"
      ],
      "rows": 2000,
      "table": true,
      "tojson": true
    },
    {
      "name": "PENN",
      "title": "PENN",
      "object": "PENN",
      "class": [
        "data.frame"
      ],
      "fields": [
        "country",
        "year",
        "log_gdp",
        "dem",
        "educ"
      ],
      "rows": 5328,
      "table": true,
      "tojson": true
    }
  ],
  "_help": [
    {
      "page": "ar2_correlation_matrix",
      "title": "compute the correlation matrix of a time series generated by an ar2 model",
      "topics": [
        "ar2_correlation_matrix"
      ]
    },
    {
      "page": "california_prop99",
      "title": "California proposition 99",
      "topics": [
        "california_prop99"
      ]
    },
    {
      "page": "CPS",
      "title": "CPS",
      "topics": [
        "CPS"
      ]
    },
    {
      "page": "decompose_Y",
      "title": "Decompose Y into components F, M, and E as described in Section 3.1.1 also computes a set of 'unit factors': the first rank left singular vectors from SVD(Y)",
      "topics": [
        "decompose_Y"
      ]
    },
    {
      "page": "did_estimate",
      "title": "synthdid_estimate for diff-in-diff estimates. Takes all the same parameters, but by default, passes options to use the diff-in-diff estimator",
      "topics": [
        "did_estimate"
      ]
    },
    {
      "page": "estimate_dgp",
      "title": "Estimates the DGP parameters used in the placebo studies in Sections 3 and 5 of the synthetic difference in differences paper. Described there in Section 3.1.1.",
      "topics": [
        "estimate_dgp"
      ]
    },
    {
      "page": "fit_ar2",
      "title": "Estimate ar2 coefficients from iid time series",
      "topics": [
        "fit_ar2"
      ]
    },
    {
      "page": "format.synthdid_estimate",
      "title": "Format a synthdid object",
      "topics": [
        "format.synthdid_estimate"
      ]
    },
    {
      "page": "lindsey_density_estimate",
      "title": "Computes a density estimator by smoothing a histogram using Poisson regression. Implementation of \"Lindsey's method\", as descrbied in Chapter 10 of \"Computer age statistical inference: algorithms, evidence, and data science' by Bradley Efron and Trevor Hastie (2016).",
      "topics": [
        "lindsey_density_estimate"
      ]
    },
    {
      "page": "panel.matrices",
      "title": "Convert a long (balanced) panel to a wide matrix",
      "topics": [
        "panel.matrices"
      ]
    },
    {
      "page": "PENN",
      "title": "PENN",
      "topics": [
        "PENN"
      ]
    },
    {
      "page": "plot.synthdid_estimate",
      "title": "Plot a synthdid object",
      "topics": [
        "plot.synthdid_estimate"
      ]
    },
    {
      "page": "print.synthdid_estimate",
      "title": "Print a synthdid object",
      "topics": [
        "print.synthdid_estimate"
      ]
    },
    {
      "page": "randomize_treatment",
      "title": "randomize treatment to n units with probability pi then if the number of treated units is zero, assign treatment to one unit uniformly at random and if the number of treated units exceeds a cap, remove treatment uniformly at random so it is exactly that cap",
      "topics": [
        "randomize_treatment"
      ]
    },
    {
      "page": "sc_estimate",
      "title": "synthdid_estimate for synthetic control estimates. Takes all the same parameters, but by default, passes options to use the synthetic control estimator By default, this uses only 'infinitesimal' ridge regularization when estimating the weights.",
      "topics": [
        "sc_estimate"
      ]
    },
    {
      "page": "simulate_dgp",
      "title": "Simulates data from DGPs used in the placebo studies in Sections 3 and 5 of the synthetic difference in differences paper. Described there in Section 3.1.1.",
      "topics": [
        "simulate_dgp"
      ]
    },
    {
      "page": "sparsify_function",
      "title": "A function mapping a numeric vector to a (presumably sparser) numeric vector of the same shape to be passed onto synthdid_estimate.",
      "topics": [
        "sparsify_function"
      ]
    },
    {
      "page": "summary.synthdid_estimate",
      "title": "Summarize a synthdid object",
      "topics": [
        "summary.synthdid_estimate"
      ]
    },
    {
      "page": "synthdid_controls",
      "title": "Outputs a table of important synthetic controls and their corresponding weights, sorted by weight. The table is truncated to exclude synthetic controls that do not matter for any estimate - for each estimate, the truncated controls may have total weight no larger that 1-mass.",
      "topics": [
        "synthdid_controls"
      ]
    },
    {
      "page": "synthdid_effect_curve",
      "title": "Outputs the effect curve that was averaged to produce our estimate",
      "topics": [
        "synthdid_effect_curve"
      ]
    },
    {
      "page": "synthdid_estimate",
      "title": "Computes the synthetic diff-in-diff estimate for an average treatment effect on a treated block.",
      "topics": [
        "synthdid_estimate"
      ]
    },
    {
      "page": "synthdid_placebo",
      "title": "Computes a placebo variant of our estimator using pre-treatment data only",
      "topics": [
        "synthdid_placebo"
      ]
    },
    {
      "page": "synthdid_placebo_plot",
      "title": "For our estimator and a placebo, plots treated and synthetic control trajectories and overlays a 2x2 diff-in-diff diagram. Requires ggplot2",
      "topics": [
        "synthdid_placebo_plot"
      ]
    },
    {
      "page": "synthdid_plot",
      "title": "Plots treated and synthetic control trajectories and overlays a 2x2 diff-in-diff diagram of our estimator. In this overlay, the treatment effect is indicated by an arrow. The weights lambda defining our synthetic pre-treatment time period are plotted below. If a list of estimates is passed, plots all of them. By default, does this in different facets. To overlay estimates in the same facet, indicate a facet for each estimator in the argument 'facet'.",
      "topics": [
        "synthdid_plot"
      ]
    },
    {
      "page": "synthdid_rmse_plot",
      "title": "A diagnostic plot for sc.weight.fw.covariates. Plots the objective function, regularized RMSE, as a function of the number of Frank-Wolfe / Gradient steps taken. Requires ggplot2",
      "topics": [
        "synthdid_rmse_plot"
      ]
    },
    {
      "page": "synthdid_se",
      "title": "Calculate the standard error of a synthetic diff in diff estimate. Deprecated. Use vcov.synthdid_estimate.",
      "topics": [
        "synthdid_se"
      ]
    },
    {
      "page": "synthdid_units_plot",
      "title": "Plots unit by unit difference-in-differences. Dot size indicates the weights omega_i used in the average that yields our treatment effect estimate. This estimate and endpoints of a 95% CI are plotted as horizontal lines. Requires ggplot2",
      "topics": [
        "synthdid_units_plot"
      ]
    },
    {
      "page": "timesteps",
      "title": "Get timesteps from panel matrix Y",
      "topics": [
        "timesteps"
      ]
    },
    {
      "page": "vcov.synthdid_estimate",
      "title": "Calculate Variance-Covariance Matrix for a Fitted Model Object",
      "topics": [
        "vcov.synthdid_estimate"
      ]
    }
  ],
  "_readme": "https://github.com/skranz/synthdid/raw/master/README.md",
  "_rundeps": [
    "mvtnorm"
  ],
  "_score": 3.739572344450092,
  "_indexed": true,
  "_nocasepkg": "synthdid",
  "_universes": [
    "skranz",
    "davidahirshberg",
    "synth-inference"
  ],
  "_binaries": [
    {
      "r": "4.7.0",
      "os": "linux",
      "version": "0.0.9",
      "date": "2026-06-05T07:33:52.000Z",
      "distro": "noble",
      "commit": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
      "fileid": "8b2ac9697b377bf767916c67da83bd485c32083f63d125fcffb4b795fdb9e13a",
      "status": "failure",
      "check": "ERROR",
      "buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618"
    },
    {
      "r": "4.6.0",
      "os": "linux",
      "version": "0.0.9",
      "date": "2026-06-05T07:33:48.000Z",
      "distro": "noble",
      "commit": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
      "fileid": "032ac9b5c01aa7a19f57c3dd9c51f470da2249a7805e7c0519c4a304bcdab9b1",
      "status": "failure",
      "check": "ERROR",
      "buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618"
    },
    {
      "r": "4.5.3",
      "os": "mac",
      "version": "0.0.9",
      "date": "2026-06-05T07:40:39.000Z",
      "commit": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
      "fileid": "3de0a4d9d4b964b96410acc910218d26c0a3a21dfb3a7bc7bb6768889d5a8c46",
      "status": "failure",
      "check": "ERROR",
      "buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618"
    },
    {
      "r": "4.6.0",
      "os": "mac",
      "version": "0.0.9",
      "date": "2026-06-05T07:35:21.000Z",
      "commit": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
      "fileid": "e8964058a0534baf6e4b87f9140ee696b8a4cba322763a7829df1cf27df708e7",
      "status": "failure",
      "check": "ERROR",
      "buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618"
    },
    {
      "r": "4.6.0",
      "os": "wasm",
      "version": "0.0.9",
      "date": "2026-06-05T07:33:50.000Z",
      "commit": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
      "fileid": "a96dc892f2c39bbae93a8524ca241ff2f3d1819a2c6ff33157cbcaea7094b578",
      "status": "success",
      "buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618"
    },
    {
      "r": "4.7.0",
      "os": "win",
      "version": "0.0.9",
      "date": "2026-06-05T07:33:02.000Z",
      "commit": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
      "fileid": "562a9e2ac908dbdeb8e7d95c9ec148165a1431f19ca84bfbf365fec384ec391a",
      "status": "failure",
      "check": "ERROR",
      "buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618"
    },
    {
      "r": "4.5.3",
      "os": "win",
      "version": "0.0.9",
      "date": "2026-06-05T07:33:01.000Z",
      "commit": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
      "fileid": "f24585824fb395265deb10aca1ed595448ee2f8c3bfd986410d139cbdfb7502d",
      "status": "failure",
      "check": "ERROR",
      "buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618"
    },
    {
      "r": "4.6.0",
      "os": "win",
      "version": "0.0.9",
      "date": "2026-06-05T07:33:01.000Z",
      "commit": "a05029b97d7118bd698c4b5aeea8516c46b4901e",
      "fileid": "e6b78abd6fdc770ca3eae55596a17605acb5ea6db99e93364833f0cab2b108ea",
      "status": "failure",
      "check": "ERROR",
      "buildurl": "https://github.com/r-universe/skranz/actions/runs/27001723618"
    }
  ]
}