tests/testthat/test_calcKMFactor.R

context("calcKMVarFactor")

test_that(
  "calcKMVarFactor returns the correct values of K_M_var_factor from Kiw",{

    ## Expected vectors were calculated by hand from the components presented in
    ## Theorem 7 in Abadie and Imbens 2006 Econometrica paper

    expect_equal(
      calcKMVarFactor(Kiw = c(1,5,10,23), M_matches = 1),
      c(2, 30, 110, 552)
    )
    expect_equal(
      calcKMVarFactor(Kiw = c(1,5,10,23), M_matches = 2),
      c(1, 10, 32.5, 149.5)
    )
}
)

Try the multilevelMatching package in your browser

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

multilevelMatching documentation built on May 8, 2019, 5:02 p.m.