Learn R Programming

⚠️There's a newer version (0.2.3) of this package.Take me there.

quickmatch

quickmatch provides functions for constructing near-optimal generalized full matchings. Generalized full matching is an extension of the original full matching method to situations with more intricate study designs. The package is made with large data sets in mind and derives matchings more than an order of magnitude quicker than other methods.

How to install

quickmatch is on CRAN and can be installed by running:

install.packages("quickmatch")

How to install development version

It is recommended to use the stable CRAN version, but the latest development version can be installed directly from Github using devtools:

if (!require("devtools")) install.packages("devtools")
devtools::install_github("fsavje/quickmatch")

The package contains compiled code, and you must have a development environment to install the development version. (Use devtools::has_devel() to check whether you do.) If no development environment exists, Windows users download and install Rtools and macOS users download and install Xcode.

Example on how to use quickmatch

# Load package
library("quickmatch")

# Construct example data
my_data <- data.frame(y = rnorm(100),
                      x1 = runif(100),
                      x2 = runif(100),
                      treatment = factor(sample(rep(c("T", "C"), c(25, 75)))))

# Make distances
my_distances <- distances(my_data, dist_variables = c("x1", "x2"))

### Average treatment effect (ATE)

# Make matching
my_matching_ate <- quickmatch(my_distances, my_data$treatment)

# Covariate balance
covariate_balance(my_data$treatment, my_data[c("x1", "x2")], my_matching_ate)

# Estimate effect
lm_match(my_data$y, my_data$treatment, my_matching_ate)


### Average treatment effect of the treated (ATT)

# Make matching
my_matching_att <- quickmatch(my_distances, my_data$treatment, target = "T")

# Covariate balance
covariate_balance(my_data$treatment, my_data[c("x1", "x2")], my_matching_att, target = "T")

# Estimate effect
lm_match(my_data$y, my_data$treatment, my_matching_att, target = "T")

Copy Link

Version

Install

install.packages('quickmatch')

Monthly Downloads

1,132

Version

0.2.2

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Fredrik Savje

Last Published

November 29th, 2023

Functions in quickmatch (0.2.2)

matching_weights

Unit weights implied by matching
lm_match

Regression-based matching estimator of treatment effects
covariate_averages

Covariate averages in matched sample
quickmatch-package

quickmatch: Quick Generalized Full Matching
is.qm_matching

Check qm_matching object
covariate_balance

Covariate balance in matched sample
qm_matching

Constructor for qm_matching objects
quickmatch

Derive generalized full matchings