tests/testthat/test-calc_metrics.R

context("calc_metrics")

test_that("calc_metrics works", {
    # create data
    set.seed(257)
    SIZE <- 15
    condition <- as.factor(c(rep("control", 2 * SIZE), rep("treatment", SIZE)))
    covariate <- c(rnorm(2 * SIZE), rnorm(SIZE, 1, 2))
    # run matching
    halting_test <- t_halt
    tiebreaker <- ad_halt
    is.in <- match_groups(condition, covariate, halting_test, print_info = FALSE)
    # calculate metrics
    expect_silent(calc_metrics(is.in, condition, covariate, halting_test,
                               tiebreaker = tiebreaker))
})

Try the ldamatch package in your browser

Any scripts or data that you put into this service are public.

ldamatch documentation built on May 23, 2021, 5:06 p.m.