nrbalancematch {approxmatch}R Documentation

The is the background function to perform matching using network optimization.


This function takes as input the information on two groups, treated and control, along with the data structure between the units of these two groups to create a matching. Custom specification of the categorization of the units for near fine balanced design and balance constraints can be provided.


nrbalancematch(cardata.fil, trt_labs, ctrl_labs, stratify, extmatch = NA, 
distmat, balanceValues, nmatch = 1)



A data frame or matrix of the dataset. The units are identified using the rownames of the data.


A logical vector of same length as nrow(cardata.fil) for the treated units.


A logical vector of same length as nrow(cardata.fil) for the control units.


A character vector of same length as nrow(cardata.fil) specifyting the categorization of the units for fine balancing.


The name of the column of cardata.fil on which design will be exactly matched. This is optional.


A numeric matrix of distances of size the number of treated units \times number of control units. The rows and columns should be named by the unit names.


A named integer vector of balance values of the categories.


Number of control units to be matched to each treated units. A positive integer.


Do not use this function directly unless you are certain of the usage.

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


A matrix of two columns first column for the treated unit and the second column for the control unit. Units in the first column will be repeated nmatch times.


Bikram Karmakar


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 Also

tripletmatching, kwaymatching

[Package approxmatch version 2.0 Index]