Skip to contents

Every matching function returns an object inheriting from class "couplr_result":

FunctionClassMatched units
match_couples(), cardinality_match()"matching_result"pairs
full_match()"full_matching_result"groups
cem_match()"cem_result"strata
subclass_match()"subclass_result"subclasses

print() gives a short overview and summary() the full report: the distribution of pair distances, the certificate conditions, the column generation rounds and the balance constraints of a cardinality matching, where present. glance() returns the headline numbers as a one-row tibble and as.data.frame() (or tidy()) the matched units, one row per pair or per unit. certificate(), potentials() and unmatched_units() read the certificate, the dual potentials and the unmatched units. Further methods take any of these results: balance_diagnostics(), join_matched(), match_data(), as_matchit() and cobalt::bal.tab().

Usage

# S3 method for class 'matching_result'
plot(x, type = c("histogram", "density", "ecdf"), ...)

# S3 method for class 'matching_result'
autoplot(object, type = c("histogram", "density", "ecdf"), ...)

# S3 method for class 'couplr_result'
glance(x, ...)

# S3 method for class 'couplr_result'
tidy(x, ...)

# S3 method for class 'couplr_result'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

# S3 method for class 'couplr_result'
print(x, ...)

# S3 method for class 'couplr_result'
summary(object, ...)

Arguments

x, object

A matching result.

type

Type of plot: "histogram" (default), "density", or "ecdf"

...

Ignored.

row.names, optional

Ignored; present for consistency with the generic.

Value

print() returns x invisibly. summary() returns an object of class "summary.couplr_result". glance() returns a one-row tibble with columns design, n_left, n_right, n_matched_left, n_matched_right, n_pairs, n_groups, total_distance, status, certified and max_suboptimality, plus best_possible, gap, n_nodes, stopped_on, size_certified (whether the largest size the constraints admit was proven, which certified also requires of the balance and distance stages) and size_seconds (how long proving it took, NA when one network solve answered the call) for a cardinality matching and n_rounds, candidate_edges and possible_edges for column generation. as.data.frame() and tidy() return the matched units.

Examples

set.seed(1)
left <- data.frame(id = 1:5, x = rnorm(5))
right <- data.frame(id = 6:15, x = rnorm(10))
m <- match_couples(left, right, vars = "x", certify = TRUE)
m
glance(m)
as.data.frame(m)
certificate(m)
summary(m)