Skip to content

Commit

Permalink
Test for effect estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
krisrs1128 committed Aug 14, 2024
1 parent 23de232 commit 9b571a8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/testthat/test-effect-estimation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# Fit random forest on toy data
xy_data <- demo_spline()
exper <- mediation_data(xy_data, starts_with("outcome"), "treatment", "mediator")
fit <- multimedia(exper, outcome_estimator = rf_model(num.trees = 1e3)) |>
estimate(exper)

test_that("Can estimate direct effects on toy dataset.", {
effects <- direct_effect(fit) |>
effect_summary()
expect_type(effects, "data.frame")
})

test_that("Can estimate indirect effects on toy dataset.", {
effects <- indirect_overall(fit) |>
effect_summary()
expect_type(effects, "data.frame")
})

0 comments on commit 9b571a8

Please sign in to comment.