
Datasets and helper functions for the book Research Design in the Social Sciences: Declaration, Diagnosis, and Redesign by Graeme Blair, Alexander Coppock, and Macartan Humphreys (Princeton University Press, 2023). The package website has a Get started article that lists which helpers each section of the book uses.
Install the released version from CRAN:
install.packages("rdss")or the development version from GitHub:
remotes::install_github("DeclareDesign/rdss")estimator_AS_tidy(), used in the book’s section on
experiments over networks, needs the ‘interference’ package, which is
not on CRAN. It works only in the GitHub version of rdss, so install
both from GitHub:
remotes::install_github("szonszein/interference")
remotes::install_github("DeclareDesign/rdss")did_multiplegt_tidy(), used in the book’s section on
difference-in-differences, needs the ‘polars’ package, which is also not
on CRAN:
install.packages("polars", repos = "https://rpolars.r-universe.dev")Each helper fills one step of a declaration in the book, and its help
page links to the section that uses it. lag_by_group(), for
instance, builds the lagged treatment indicator in the
difference-in-differences design:
library(rdss)
library(dplyr)
panel <-
tibble(
unit = rep(c("a", "b"), each = 3),
period = rep(1:3, times = 2),
D = c(0, 1, 1, 0, 0, 1)
) |>
mutate(D_lag = lag_by_group(D, groups = unit, n = 1, order_by = period))
panel## # A tibble: 6 × 4
## unit period D D_lag
## <chr> <int> <dbl> <dbl>
## 1 a 1 0 NA
## 2 a 2 1 0
## 3 a 3 1 1
## 4 b 1 0 NA
## 5 b 2 0 0
## 6 b 3 1 0