Learn R Programming

randotools (version 0.2.4)

imbalance_test_plot: Plot imbalance and simulation and test results

Description

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)

Value

list of ggplots or a patchwork off ggplots (if 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

imbalance_test()

Examples

Run this code
# example code
data(rando_balance)
# without stratification variables
imb <- imbalance_test(rando_balance, "rando_res2", stratavars = c("strat1", "strat2"), n_iter = 50)
imbalance_test_plot(imb)

Run the code above in your browser using DataLab