Functions for Optimal Non-Bipartite Matching

Perform non-bipartite matching and matched randomization. A "bipartite" matching utilizes two separate groups, e.g. smokers being matched to nonsmokers or cases being matched to controls. A "non-bipartite" matching creates mates from one big group, e.g. 100 hospitals being randomized for a two-arm cluster randomized trial or 5000 children who have been exposed to various levels of secondhand smoke and are being paired to form a greater exposure vs. lesser exposure comparison. At the core of a non-bipartite matching is a N x N distance matrix for N potential mates. The distance between two units expresses a measure of similarity or quality as mates (the lower the better). The 'gendistance()' and 'distancematrix()' functions assist in creating this. The 'nonbimatch()' function creates the matching that minimizes the total sum of distances between mates; hence, it is referred to as an "optimal" matching. The 'assign.grp()' function aids in performing a matched randomization. Note bipartite matching can be performed using the prevent option in 'gendistance()'.


nbpmatching 1.5.1

  • Bug fix, handles distancematrix with all zeroes
  • Rework how nonbimatch handles precision when input includes Inf distances
  • Bug fix, nonbimatch passes precision to Fortran call
  • nonbimatch creates class of the same name
  • add subsetMatches method
  • include nonbimatch-method for assign.grp, qom, get.sets
  • gendistance produces Inf distance to phantoms on elements with forced matches
  • documentation fix for undocumented S4 methods warning
  • moving suggested package testthat outside of package

nbpmatching 1.5.0

  • Updated NAMESPACE to include default packages other than base
  • Removed distance scaling in gendistance
  • gendistance and make.phantoms use max distance Inf
  • Removed integer constraint on distancematrix
  • Update documentation to reference Mahalanobis distance calculation

nbpmatching 1.4.5

  • Improved package description
  • Bug fix, specifying threshold with nonbimatch failed on R 3.2.0; thanks Philippe Sulger.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.5.1 by Cole Beck, 3 years ago

Browse source code at

Authors: Cole Beck [aut, cre] , Bo Lu [aut] , Robert Greevy [aut]

Documentation:   PDF Manual  

GPL (>= 2) license

Imports methods, stats, Hmisc, MASS, utils

Imported by GPSCDF.

Depended on by crossmatch, nearfar.

Suggested by blockTools, hamlet.

See at CRAN