Skip to contents

plot the bootstrap version of the jointVIP object

Usage

bootstrap.plot(
  x,
  ...,
  smd = "cross-sample",
  use_abs = TRUE,
  plot_title = "Joint Variable Importance Plot",
  B = 100
)

Arguments

x

a jointVIP object

...

custom options: bias_curve_cutoffs, text_size, max.overlaps, label_cut_std_md, label_cut_outcome_cor, label_cut_bias, bias_curves, add_var_labs

smd

specify the standardized mean difference is cross-sample or pooled

use_abs

TRUE (default) for absolute measures

plot_title

optional string for plot title

B

100 (default) for the number of times the bootstrap step wished to run

Value

a joint variable importance plot of class ggplot

Examples

data <- data.frame(year = rnorm(50, 200, 5),
                   pop = rnorm(50, 1000, 500),
                   gdpPercap = runif(50, 100, 1000),
                   trt = rbinom(50, 1, 0.5),
                   out = rnorm(50, 1, 0.2))
# random 20 percent of control as pilot data
pilot_sample_num = sample(which(data$trt == 0),
                          length(which(data$trt == 0)) *
                          0.2)
pilot_df = data[pilot_sample_num, ]
analysis_df = data[-pilot_sample_num, ]
treatment = "trt"
outcome = "out"
covariates = names(analysis_df)[!names(analysis_df)
                                %in% c(treatment, outcome)]
new_jointVIP = create_jointVIP(treatment = treatment,
                               outcome = outcome,
                               covariates = covariates,
                               pilot_df = pilot_df,
                               analysis_df = analysis_df)
# more bootstrap number B would be typically used in real settings
# this is just a small example
set.seed(1234567891)
bootstrap.plot(new_jointVIP, B = 15)
#> Scale for y is already present.
#> Adding another scale for y, which will replace the existing scale.