MyNixOS website logo
Description

Simulation Tool for Causal Inference Using Longitudinal Data.

Implements a simulation study to assess the strengths and weaknesses of causal inference methods for estimating policy effects using panel data. See Griffin et al. (2021) <doi:10.1007/s10742-022-00284-w> and Griffin et al. (2022) <doi:10.1186/s12874-021-01471-y> for a description of our methods.

optic

Simulation Tool for Causal Inference Using Longitudinal Data

R-CMD-check TestCoverage

The 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.

Background and Rationale

Recent 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 (Griffin et al. 2021; Griffin et al. 2023) to study the performance of various methods under different scenarios. Our publications to date are as follows:

  1. In Griffin et al. (2021), 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.

  2. In Griffin et al. (2023), 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.

Assessing 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.

The 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-Michael, Feller, and Rothstein 2021; Callaway and Sant’Anna 2021).

Why optic?

optic is named after the Opioid Policy Tools and Information Center (OPTIC) project.

Installation

You will need R (version 4.1.0 or above) to use this package. You can install the optic R package from the R console:

# install from CRAN:
install.packages("optic")

# or install the development version from github:
# install remotes if needed
install.packages("remotes")
remotes::install_github("RANDCorporation/optic")

Usage

The introductory vignette 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.

Contact

Reach out to Beth Ann Griffin for questions related to this repository.

License

Copyright (C) 2023 by The RAND Corporation. This repository is released as open-source software under a GPL-3.0 license. See the LICENSE file.

About this Tool

This 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.

RAND 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, or contact

RAND Health Care Communications
1776 Main Street
P.O. Box 2138
Santa Monica, CA 90407-2138
(310) 393-0411, ext. 7775
[email protected]

References

Ben-Michael, Eli, Avi Feller, and Jesse Rothstein. 2021. “The Augmented Synthetic Control Method.” Journal of the American Statistical Association 116 (536): 1789–1803.

Callaway, Brantly, and Pedro H. C. Sant’Anna. 2021. “Difference-in-Differences with Multiple Time Periods.” Journal of Econometrics 225 (2): 200–230. https://doi.org/10.1016/j.jeconom.2020.12.001.

Griffin, Beth Ann, Megan S. Schuler, Joseph Pane, Stephen W. Patrick, Rosanna Smart, Bradley D. Stein, Geoffrey Grimm, and Elizabeth A. Stuart. 2023. “Methodological Considerations for Estimating Policy Effects in the Context of Co-Occurring Policies.” Health Services and Outcomes Research Methodology, June. https://doi.org/10.1007/s10742-022-00284-w.

Griffin, Beth Ann, Megan S. Schuler, Elizabeth A. Stuart, Stephen Patrick, Elizabeth McNeer, Rosanna Smart, David Powell, Bradley D. Stein, Terry L. Schell, and Rosalie Liccardo Pacula. 2021. “Moving Beyond the Classic Difference-in-Differences Model: A Simulation Study Comparing Statistical Methods for Estimating Effectiveness of State-Level Policies.” BMC Medical Research Methodology 21 (1): 279. https://doi.org/10.1186/s12874-021-01471-y.

optic. n.d. “Introduction to OPTIC.” Accessed June 16, 2023. https://randcorporation.github.io/optic/articles/intro_optic.html.

R. n.d. “The R Project for Statistical Computing.” Accessed June 16, 2023. https://www.r-project.org/.

RAND Corporation. n.d.a. “Beth Ann Griffin.” Accessed June 20, 2023. https://www.rand.org/about/people/g/griffin_beth_ann.html.

———. n.d.b. “Homepage.” Accessed June 20, 2023. https://www.rand.org.

———. n.d.c. “RAND-USC Schaeffer Opioid Policy Tools and Information Center (OPTIC).” Accessed June 20, 2023. https://www.rand.org/health-care/centers/optic.html.

rdrr.io. n.d. “Install.packages: Install Packages from Repositories or Local Files.” Accessed June 20, 2023. https://rdrr.io/r/utils/install.packages.html.

Metadata

Version

1.0.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows