Skip to contents

This function plots the density of APO for a specified effect type from bayesmsm output.

Usage

plot_APO(input, effect_type, ...)

Arguments

input

A data frame or model object containing bootstrap results.

effect_type

A character string specifying which effect to plot (e.g., comparator or reference treatment sequences).

...

Additional arguments passed to the plotting function.

Value

A ggplot object representing density plot showing the distribution of the specified average potential outcome (reference or comparison).

Examples

testdata <- read.csv(system.file("extdata",
                     "continuous_outcome_data.csv",
                     package = "bayesmsm"))
model <- bayesmsm(ymodel = y ~ a_1+a_2,
                   nvisit = 2,
                   reference = c(rep(0,2)),
                   comparator = c(rep(1,2)),
                   treatment_effect_type = "sq",
                   family = "gaussian",
                   data = testdata,
                   wmean = rep(1, 1000),
                   nboot = 10,
                   optim_method = "BFGS",
                   parallel = FALSE)
plot_APO(model$bootdata, effect_type = "effect_comparator")

plot_APO(model, effect_type = "effect_reference")