Nothing
# This file contains only a bare bones set of tests.
# Please add future tests to manual_tests/test-PanelMatch.R
# Similarly, please test package against that set of tests before submitting.
# For this, use testthat::test_dir()
test_that("(ATT) PanelEstimate Runs", {
qoi_ <- "att"
pm1 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
treatment = "dem", refinement.method = "mahalanobis",
data = dem, match.missing = FALSE, covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
size.match = 5, qoi = qoi_,
outcome.var = "y",
lead = 0:3, forbid.treatment.reversal = FALSE)
pe.results <- PanelEstimate(pm1, data = dem, se.method = "conditional")
comp.results <- c(-0.593399771464233,-0.321260212377162,0.456311286847623,1.73182162255356)
expect_equivalent(pe.results$estimates, comp.results)
})
test_that("(ATC) PanelEstimate Runs", {
qoi_ <- "atc"
pm1 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
treatment = "dem", refinement.method = "mahalanobis",
data = dem, match.missing = FALSE, covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
size.match = 5, qoi = qoi_,
outcome.var = "y",
lead = 0:3, forbid.treatment.reversal = FALSE)
pe.results <- PanelEstimate(pm1, data = dem, se.method = "conditional")
comp.results <- c(-0.7399887, -0.1418777, -0.4914594, -0.1423150)
expect_equivalent(pe.results$estimates, comp.results, tolerance = .000001)
})
test_that("(ART) PanelEstimate Runs", {
qoi_ <- "art"
pm1 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
treatment = "dem", refinement.method = "mahalanobis",
data = dem, match.missing = FALSE, covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
size.match = 5, qoi = qoi_,
outcome.var = "y",
lead = 0:3, forbid.treatment.reversal = FALSE)
pe.results <- PanelEstimate(pm1, data = dem, se.method = "conditional")
comp.results <- -c(5.2177188648897,8.02138564165901,8.75646876914828,8.12399471507353)
expect_equivalent(pe.results$estimates, comp.results)
})
test_that("(ATE) PanelEstimate Runs", {
qoi_ <- "ate"
pm1 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
treatment = "dem", refinement.method = "mahalanobis",
data = dem, match.missing = FALSE, covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
size.match = 5, qoi = qoi_,
outcome.var = "y",
lead = 0:3, forbid.treatment.reversal = FALSE)
pe.results <- PanelEstimate(pm1, data = dem, number.iterations = 300)
comp.results <- c(-0.73400424, -0.14920097, -0.45276678, -0.06580353)
expect_equivalent(pe.results$estimates, comp.results, tolerance = .0000001)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.