Skip to contents

Plot histograms of imbalance values from simulated random allocation and a vertical lines to indicate the observed imbalance for each randomisation level (overall, stratification variable level, and strata level, where appropriate). The p-values from the tests are included in the figure captions.

Usage

imbalance_test_plot(test, vline_col = "red", stack = TRUE)

Arguments

test

imbalance_test object

vline_col

colour for the vertical line indicating the observed imbalance

stack

logical, whether to use patchwork::wrap_plots to stack the plots in one column (TRUE) or return a list of ggplot objects (FALSE)

See also

Examples

# example code
data(rando_balance)
# without stratification variables
imb <- imbalance_test(rando_balance, "rando_res2", stratavars = c("strat1", "strat2"))
#> assuming balanced randomisation between arms
#> Simulating randomisations ■■■■                              10% | ETA: 27s
#> Simulating randomisations ■■■■■■■■■■                        29% | ETA: 21s
#> Simulating randomisations ■■■■■■■■■■■■■                     40% | ETA: 18s
#> Simulating randomisations ■■■■■■■■■■■■■■■■                  50% | ETA: 15s
#> Simulating randomisations ■■■■■■■■■■■■■■■■■■■               60% | ETA: 12s
#> Simulating randomisations ■■■■■■■■■■■■■■■■■■■■■■            70% | ETA:  9s
#> Simulating randomisations ■■■■■■■■■■■■■■■■■■■■■■■■■         80% | ETA:  6s
#> Simulating randomisations ■■■■■■■■■■■■■■■■■■■■■■■■■■■■      90% | ETA:  3s
imbalance_test_plot(imb)