{"id":32200455,"url":"https://github.com/randcorporation/optic","last_synced_at":"2025-10-22T03:48:32.582Z","repository":{"id":156867730,"uuid":"610391828","full_name":"RANDCorporation/optic","owner":"RANDCorporation","description":"optic: Simulation Tool for Causal Inference Using Longitudinal Data","archived":false,"fork":false,"pushed_at":"2025-07-25T14:45:38.000Z","size":53050,"stargazers_count":9,"open_issues_count":12,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-22T03:48:17.839Z","etag":null,"topics":["causal-inference","diff-in-diff","longitudinal-data","simulation"],"latest_commit_sha":null,"homepage":"https://randcorporation.github.io/optic/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RANDCorporation.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-06T17:20:27.000Z","updated_at":"2025-01-17T16:12:16.000Z","dependencies_parsed_at":"2025-01-16T01:25:21.802Z","dependency_job_id":"b140bc7e-d893-4a9a-8341-a44f8bdabb6e","html_url":"https://github.com/RANDCorporation/optic","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/RANDCorporation/optic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RANDCorporation%2Foptic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RANDCorporation%2Foptic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RANDCorporation%2Foptic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RANDCorporation%2Foptic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RANDCorporation","download_url":"https://codeload.github.com/RANDCorporation/optic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RANDCorporation%2Foptic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280376535,"owners_count":26320276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["causal-inference","diff-in-diff","longitudinal-data","simulation"],"created_at":"2025-10-22T03:48:30.322Z","updated_at":"2025-10-22T03:48:32.573Z","avatar_url":"https://github.com/RANDCorporation.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\nbibliography: ./vignettes/optic_refs.json\n#csl: https://www.zotero.org/styles/lancet\nlink-citations: yes\nlinkcolor: blue\nnocite: '@*'\n---\n\n\u003c!-- README.md is generated from README.Rmd.  Please edit that file. --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# optic \u003ca href='https://github.com/RANDCorporation/optic'\u003e\u003cimg src='man/figures/optic.png' align=\"right\" height=\"139\"  style=\"height:139px !important;\" /\u003e\u003c/a\u003e\n**Simulation Tool for Causal Inference Using Longitudinal Data**\n\n[![R-CMD-check](https://github.com/RANDCorporation/optic/workflows/R-CMD-check/badge.svg)](https://github.com/RANDCorporation/optic/actions)\n[![Test Coverage](https://github.com/RANDCorporation/optic/workflows/test-coverage/badge.svg)](https://github.com/RANDCorporation/optic/actions)\n\n\u003c!-- badges: end\n[![codecov](https://codecov.io/gh/RANDCorporation/optic/branch/develop/graph/badge.svg?token=5XYDOFFJMH)](https://codecov.io/gh/RANDCorporation/optic)\n--\u003e\n\nThe `optic` R package helps you scrutinize candidate causal inference models using **your own** longitudinal data. Researchers from the Opioid Policy Tools and Information Center (OPTIC) initially created the tool to examine longitudinal data related to opioids, but its framework can be used with longitudinal data on topics other than opioids.\n\n## Background and Rationale\n\nRecent difference-in-differences (DID) literature revealed issues with the traditional DID model, but we found it very difficult to evaluate the relative performance of different causal inference methods using our own data. Thus, we designed a series of simulations [@griffinMovingClassicDifferenceindifferences2021;   @griffinMethodologicalConsiderationsEstimating2023] to study the performance of various methods under different scenarios. Our publications to date are as follows:\n\n1. In @griffinMovingClassicDifferenceindifferences2021, we use real-world data on opioid mortality rates to assess commonly used statistical models for DID designs, which are widely used in state policy evaluations. These experiments demonstrated notable limitations of those methods. In contrast, the optimal model we identified—the autoregressive (AR) model—showed a lot of promise. That said, do not just take our word for it; try it out with your own data and see how various approaches perform relative to one another. See the “Usage” section for details.\n\n2. In @griffinMethodologicalConsiderationsEstimating2023, we demonstrate that it is critical to be able to control for effects of co-occurring policies and understand the potential bias that might arise from not controlling for those policies. Our package can help you assess the impact of co-occurring policies on the performance of commonly used statistical models in state policy evaluations.\n\nAssessing those methods in a systematic way might be challenging, but you can now use our `optic` R package to simulate policy effects and compare causal inference models using your own data.\n\nThe package supports the traditional two-way fixed effects DID model and the AR model, as well as other leading methods, such as augmented synthetic control and the Callaway-Sant’Anna approach to DID [@ben-michaelAugmentedSyntheticControl2021;   @callawayDifferenceinDifferencesMultipleTime2021].\n\n### Why `optic`?\n\n`optic` is named after the **Opioid Policy Tools and Information Center (OPTIC)** project.\n\n## Installation\n\nYou will need [R (version 4.1.0 or above)](https://www.r-project.org) to use this package. You can install the `optic` R package from the `R` console:\n\n``` r\n# install from CRAN:\ninstall.packages(\"optic\")\n\n# or install the development version from github:\n# install remotes if needed\ninstall.packages(\"remotes\")\nremotes::install_github(\"RANDCorporation/optic\")\n```\n\n## Usage\n\nThe [introductory vignette](https://randcorporation.github.io/optic/articles/intro_optic.html) provides a working example using a sample `overdoses` dataset provided with the package. `optic` provides three main functions: `optic_model`, `optic_simulation`, and `dispatch_simulations`. Use `optic_model` to define model specifications for each causal model to be tested in the simulation experiment. Then, pass your models, your data, and your parameters to the `optic_simulation` function, which specifies a set of simulations to be performed for each `optic_model` included in your `list` of models. Finally, use `dispatch_simulations` to run your simulations in parallel.\n\n## Contact\n\nReach out to [Beth Ann Griffin](https://www.rand.org/about/people/g/griffin_beth_ann.html) for questions related to this repository.\n\n\n## License \n\nCopyright (C) 2023 by The [RAND Corporation](https://www.rand.org). This repository is released as open-source software under a GPL-3.0 license. See the LICENSE file.\n\n## About this Tool\n\nThis research was financially supported through a National Institute on Drug Abuse grant (P50DA046351) to the RAND Corporation and carried out within the Access and Delivery Program in RAND Health Care.\n\nRAND Health Care, a division of the RAND Corporation, promotes healthier societies by improving health care systems in the United States and other countries. We do this by providing health care decisionmakers, practitioners, and consumers with actionable, rigorous, objective evidence to support their most complex decisions. For more information, see [www.rand.org/health-care](https://www.rand.org/health-care), or contact\n\n**RAND Health Care Communications**  \n1776 Main Street  \nP.O. Box 2138  \nSanta Monica, CA 90407-2138  \n(310) 393-0411, ext. 7775  \nRAND_Health-Care@rand.org\n\n## References\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandcorporation%2Foptic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandcorporation%2Foptic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandcorporation%2Foptic/lists"}