# triples_st: Create a triples match for a single stratum In triplesmatch: Match Triples Consisting of Two Controls and a Treated Unit or Vice Versa

 triples_st R Documentation

## Create a triples match for a single stratum

### Description

Create a triples match for a single stratum

### Usage

``````triples_st(cost, z, solver = "rrelaxiv")
``````

### Arguments

 `cost` Matrix of distances between treated (rows) and control (columns) units within the stratum `z` Vector of treatment assignments for units within the stratum (0 for control, 1 for treated) `solver` Solver to use for the network problem. Either 'rrelaxiv' or 'rlemon'. 'rrelaxiv' can be downloaded from "https://github.com/josherrickson/rrelaxiv/"

### Value

Named list with three elements: 'm' contains the triples match. This is in the form of a data.frame with number of rows equal to the number of triples and 7 columns specifying the match number, the names of the three units within the match, the costs of the two treated-control pairs within the match, and the number of treated units. 'obj' contains the total objective from the network optimization and 'bound' contains a loose lower bound on the objective of the optimal match.

### Examples

``````set.seed(10)
n <- 20
x <- rnorm(n, 0, 1)
nt <- floor(n * 0.62)
nc <- n - nt
z <- c(rep(1, nt), rep(0, nc))
dist <- dist_mahal(data.frame(x = x), z, rep(1, n))[[1]]
triples_st(cost = dist, z = z, solver = "rlemon")

``````

triplesmatch documentation built on Oct. 23, 2023, 5:09 p.m.