-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23de232
commit 9b571a8
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
}) |