README.md

rollmatch

travis-ci build status CRAN statusbadge DOI

Rolling Entry Matching R Package

rollmatch is an R package designed to match study participants that start interventions at different times (rolling entry) with an appropriate comparison for the purpose of impact evaluation. Rolling entry presents several challenges for comparison group selection:

This method, called Rolling Entry Matching, assigns potential comparison non-participants multiple counterfactual entry periods which allows for matching of participant and non-participants based on data immediately preceding each participant's specific entry period, rather than using data from a fixed pre-intervention period.

References

Video

Watch the Intro Video

Installation

# Install from CRAN:
install.packages("rollmatch")

# Or try out the development version on GitHub:
# install.packages("devtools")
devtools::install_github("RTIInternational/rollmatch")

Usage

# Load rollmatch
library(rollmatch)

# Load sample dataset
data(package="rollmatch", "rem_synthdata_small")

# Reduce the input dataset size, for matching 
reduced_data <- reduce_data(data = rem_synthdata_small, treat = "treat",
                            tm = "quarter", entry = "entry_q",
                            id = "indiv_id", lookback = 1)

# Choose confounding variables hypothesized to be associated with both treatment and outcome
fm <- as.formula(treat ~ qtr_pmt + yr_pmt + age)
vars <- all.vars(fm)

# Calculate propensity scores for the reduced data
scored_data <- score_data(reduced_data = reduced_data,
                          model_type = "logistic", match_on = "logit",
                          fm = fm, treat = "treat",
                          tm = "quarter", entry = "entry_q", id = "indiv_id")

# Run the rolling entry matching algorithm
output <- rollmatch(scored_data, data=rem_synthdata_small, treat = "treat",
                    tm = "quarter", entry = "entry_q", id = "indiv_id",
                    vars = vars, lookback = 1, alpha = .2,
                    standard_deviation = "average", num_matches = 3,
                    replacement = TRUE)

# View output matches and diagnostics
output


RTIInternational/rollmatch documentation built on Feb. 17, 2024, 2:31 p.m.