approxmatch-package {approxmatch}R Documentation

Approximately Optimal Fine Balance Matching with Multiple Groups.


Tools for constructing a matched design with multiple comparison groups. Further specifications of refined covariate balance restriction and exact match on covariate can be imposed. Matches are approximately optimal in the sense that the cost of the solution is at most twice the optimal cost, Crama and Spieksma (1992) <doi:10.1016/0377-2217(92)90078-N>, Karmakar, Small and Rosenbaum (2019) <doi:10.1080/10618600.2019.1584900>.


Index of help topics:

Dodgeram                Dodge ram pk 2500 data on side airbag (SAB)
                        usage from 1995 to 2015
approxmatch-package     Approximately Optimal Fine Balance Matching
                        with Multiple Groups.
covbalance              Check covariate balance of a design.
kwaymatching            Create approximately optimal matched strata of
                        multiple, at least two, groups.
multigrp_dist_struc     Construct the distance structure for the
                        multiple groups.
nrbalancematch          The is the background function to perform
                        matching using network optimization.

An R package for creating matched strata with multiple treatments. Default design for a stratum structure is one unit from each treatment, but, other designs can be specified. User can also fine match/ near fine match on one or more categorical covariates, e.g. sex and age group.

The main functions of the package are kwaymatching and tripletmatch. These functions take as input the distance structure of multiple groups and the grouping information to create an approximately optimal multigroup design minimizing the total distance. A distance structure can be calculated as per requirement by the multigrp_dist_struc function.

The algorithm used to create matched design is an approximation algorithm developed by Karmakar, Small and Rosenbaum (2019). The design built is guaranteed to be close to the optimal matched design of the specified structure.

IMPORTANT NOTE: In order to perform matching, kwaymatching requires the user to load the optmatch (>= 0.9-1) package separately. A manual loading is required due to software license issues. If the package is not loaded, the kwaymatching command will fail with an error saying the optmatch package is not present. Reference to optmatch is given below.


Bikram Karmakar

Maintainer: Bikram Karmakar <>


Crama, Y. and Spieksma, F. C. R. (1992), Approximation algorithms for three-dimensional assignment problems with triangle inequalities, European Journal of Operational Research 60, 273–279.

Hansen, B.B. and Klopfer, S.O. (2006) Optimal full matching and related designs via network flows, JCGS 15 609–627.

Karmakar, B., Small, D. S. and Rosenbaum, P. R. (2019) Using Approximation Algorithms to Build Evidence Factors and Related Designs for Observational Studies, Journal of Computational and Graphical Statistics, 28, 698–709.


## See kwaymatching for usage

[Package approxmatch version 2.0 Index]