Policy effects: Policy A vs. Policy B

R-CMD-check pkgdown Codecov test coverage License: MIT Lifecycle: experimental

library(dynasimR)
sim <- load_example_data()

The core comparison

The two Profile A scenarios A-S07 (policy B) and A-S08 (policy A, priority by severity) differ only in the allocation policy.

pol <- policy_effect(
  sim,
  policy_a_scenario = "A-S08",
  policy_b_scenario = "A-S07",
  n_bootstrap       = 500
)
print(pol)
#> 
#> ── dynasimR_policy ─────────────────────────────────────────────────────────────
#> • Policy A: "A-S08"
#> • Policy B: "A-S07"
#> • n (reps): 50
#> 
#> ── Delta event rate ──
#> 
#> # A tibble: 4 × 4
#>   group median_pct_points  ci_lo ci_hi
#>   <chr>             <dbl>  <dbl> <dbl>
#> 1 all               -7.37  -9.13 -5.53
#> 2 A                -10.6  -14.0  -6.88
#> 3 B                -11.3  -15.9  -7.75
#> 4 C                 -9.39 -16.0  -4.05
#> ── Narrative ──
#> The policy A-minus-B event-rate difference (scenario A-S08 vs. A-S07) was -7.4 percentage points (95% CI: -9.1 to -5.5); the event rate was lower under policy A (Wilcoxon test: W = 215, adjusted p < 0.001). The Compliance Index was higher under policy A (0.919 vs. 0.658).

Delta event-rate visualisation

plot_policy(pol)

Auto-generated narrative

The narrative slot is plain text with literal scenario identifiers and a confidence label matching the requested alpha. Review it in the context of your simulation design before using it in a report. It is not escaped LaTeX; escape special characters before inserting it into a .tex document:

cat(pol$narrative)
#> The policy A-minus-B event-rate difference (scenario A-S08 vs. A-S07) was -7.4 percentage points (95% CI: -9.1 to -5.5); the event rate was lower under policy A (Wilcoxon test: W = 215, adjusted p < 0.001). The Compliance Index was higher under policy A (0.919 vs. 0.658).

Effect sizes

pol$effect_sizes
#> # A tibble: 3 × 2
#>   metric                  value
#>   <chr>                   <dbl>
#> 1 Cohen_d_event         -1.95  
#> 2 Risk_Difference_event -0.0685
#> 3 NNT_surrogate         14.6