Skip to content

Commit

Permalink
test for new sensitivity functions
Browse files Browse the repository at this point in the history
  • Loading branch information
krisrs1128 committed Aug 19, 2024
1 parent 213ce51 commit 588b503
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/testthat/test-sensitivity.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

xy_data <- demo_spline()
exper <- mediation_data(xy_data, starts_with("outcome"), "treatment", "mediator")
model <- multimedia(exper, outcome_estimator = rf_model(num.trees = 1e3)) |>
estimate(exper)

sensitivity_curve <- sensitivity(model, exper, n_rho = 10)
test_that("Sensitivity curve has correct bounds.", {
expect_equal(nrow(sensitivity_curve), 10)
})

test_that("Sensitivity curve has correct column names.", {
expect_named(sensitivity_curve, c("rho", "indirect_overall"))
})

0 comments on commit 588b503

Please sign in to comment.