Univariate case…

library(ldamatch)
set.seed(257)

SIZE <- 15
condition <- as.factor(c(rep("control", 2 * SIZE), rep("treatment", SIZE)))
covariate1 <- c(rnorm(2 * SIZE), rnorm(SIZE, 1, 2))

Multivariate case…

covariate2 <- c(rnorm(2 * SIZE), rnorm(SIZE, 1, 2))
covariates <- cbind(covariate1, covariate2)

Multivariate case (with special proportions and Wilcox test)…

my.props <- prop.table(c(control = 4, treatment = 3))
is.in <- ldamatch(condition, covariates, U_halt, props = my.props)
## Initial group sizes:  control: 30    treatment: 15 
## Starting heuristic search.
## Finished heuristic search in 0.045 seconds.
## Eventual group sizes: control: 20    treatment: 15 
## Removed subjects:     control: 10    treatment: 0
print(table(condition, is.in))
##            is.in
## condition   FALSE TRUE
##   control      10   20
##   treatment     0   15

Multivariate case (with Wilks test)…

is.in <- ldamatch(condition, covariates, wilks_halt)
## Initial group sizes:  control: 30    treatment: 15 
## Starting heuristic search.
## Finished heuristic search in 0.036 seconds.
## Eventual group sizes: control: 25    treatment: 12 
## Removed subjects:     control: 5 treatment: 3
print(table(condition, is.in))
##            is.in
## condition   FALSE TRUE
##   control       5   25
##   treatment     3   12

Multivariate case (with t-test and Anderson-Darling test simultaneously)…

combined_halting_test <- create_halting_test(c(t_halt, ad_halt))
threshes <- c(.2, .02)
is.in <- ldamatch(condition, covariates, combined_halting_test, threshes)
## Initial group sizes:  control: 30    treatment: 15 
## Starting heuristic search.
## Finished heuristic search in 0.129 seconds.
## Eventual group sizes: control: 25    treatment: 13 
## Removed subjects:     control: 5 treatment: 2
print(table(condition, is.in))
##            is.in
## condition   FALSE TRUE
##   control       5   25
##   treatment     2   13