undidr

Difference-in-differences for unpoolable data.

https://github.com/ebjamieson97/undidr

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.0%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Difference-in-differences for unpoolable data.

Basic Info
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# undidR


[![R-CMD-check](https://github.com/ebjamieson97/undidR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ebjamieson97/undidR/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/ebjamieson97/undidR/graph/badge.svg)](https://app.codecov.io/gh/ebjamieson97/undidR)
[![CRAN status](https://www.r-pkg.org/badges/version/undidR)](https://CRAN.R-project.org/package=undidR)


The **undidR** package provides the framework for implementing difference-in-differences with unpoolable data (UNDID) developed in [Karim, Webb, Austin, and Strumpf (2024)](https://arxiv.org/abs/2403.15910v2). UNDID is designed to estimate the average treatment effect on the treated (ATT) in settings where data from different silos cannot be pooled together (potentially for reasons of confidentiality). The package supports both common and staggered adoption scenarios, as well as the optional inclusion of covariates. Additionally, **undidR** incorporates a randomization inference (RI) procedure, based on [MacKinnon and Webb (2020)](https://doi.org/10.1016/j.jeconom.2020.04.024), for calculating p-values for the UNDID ATT.

See the image below for an overview of the **undidR** framework:
```{r schematic, echo=FALSE, fig.align='center', out.width='90%'}
knitr::include_graphics("vignettes/figures/undidR_schematic.png")
```

## Installation

You can install the stable release version of `undidR` from [CRAN](https://CRAN.R-project.org/package=undidR) with:

```{r, eval=FALSE}
install.packages("undidR")
```

## Examples

For a set of highly detailed examples see the package vignette using:
```{r, eval=FALSE}
vignette("undidR", package = "undidR")
```

The following code chunks show some basic examples of using **undidR** at each of its three stages.

### Stage One: `create_init_csv()` & `create_diff_df()`
```{r example}
library(undidR)
init <- create_init_csv(silo_names = c("73", "46", "54", "23", "86", "32",
                                       "71", "58", "64", "59", "85", "57"),
                        start_times = "1989",
                        end_times = "2000",
                        treatment_times = c(rep("control", 6),
                                            "1991", "1993", "1996", "1997",
                                            "1997", "1998"))
init

init_filepath <- normalizePath(file.path(tempdir(), "init.csv"),
                               winslash = "/", mustWork = FALSE)
empty_diff_df <- create_diff_df(init_filepath, date_format = "yyyy",
                                freq = "yearly",
                                covariates = c("asian", "black", "male"))
head(empty_diff_df, 4)
```

### Stage Two: `undid_stage_two()`
```{r}
silo_data <- silo71
empty_diff_filepath <- system.file("extdata/staggered", "empty_diff_df.csv",
                                   package = "undidR")
stage2 <- undid_stage_two(empty_diff_filepath, silo_name = "71",
                          silo_df = silo_data, time_column = "year",
                          outcome_column = "coll", silo_date_format = "yyyy")
head(stage2$diff_df, 4)
head(stage2$trends_data, 4)
```

### Stage Three: `undid_stage_three()`
```{r}
dir_path <- system.file("extdata/staggered", package = "undidR")
results <- undid_stage_three(dir_path, agg = "silo", covariates = TRUE,
                             nperm = 501)
results
```

Owner

  • Name: Eric Bruce Jamieson
  • Login: ebjamieson97
  • Kind: user

GitHub Events

Total
  • Push event: 20
  • Public event: 1
  • Create event: 1
Last Year
  • Push event: 20
  • Public event: 1
  • Create event: 1

Packages

  • Total packages: 1
  • Total downloads:
    • cran 373 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: undidR

Difference-in-Differences with Unpoolable Data

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 373 Last month
Rankings
Dependent packages count: 27.4%
Dependent repos count: 33.7%
Average: 49.3%
Downloads: 86.9%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • R >= 4.0 depends