Skip to contents

Create comprehensive visualizations for power analysis results from rctbp_power_analysis objects. Supports different plot types based on analysis type (sample_only, effect_only, or both varying).

Arguments

x

An rctbp_power_analysis object that has been run with results

type

Type of plot to create:

  • "auto" - Automatically detect best plot type based on analysis (default)

  • "power_curve" - Power curve across single varying dimension

  • "heatmap" - 2D heatmap when both sample sizes and effect sizes vary

  • "integrated" - Integrated power results when design prior is used

  • "comparison" - Compare power vs posterior probabilities

metric

Which power metric to display:

  • "success" - Success power and probability

  • "futility" - Futility power and probability

  • "both" - Both success and futility power and probabilities (default)

values

Which values to display:

  • "both" - Both power and posterior probabilities (default)

  • "power" - Power only

  • "post_prob" - Posterior probabilities only

show_target

Whether to show target power lines (default: TRUE)

show_integrated

Whether to include integrated power when available (default: TRUE)

facet_by

For power_curve plots when both sample sizes and effect sizes vary:

  • "effect_size" - Facet by effect size, vary sample size on x-axis (default)

  • "sample_size" - Facet by sample size, vary effect size on x-axis

design_prior

Optional design prior for runtime integrated power computation. Can be:

  • A string in brms prior syntax (e.g., "normal(0.3, 0.1)", "student_t(6, 0.5, 0.2)")

  • An R function taking effect size as input (e.g., function(x) dnorm(x, 0.5, 0.2))

  • NULL for no runtime integration (default)

If provided, integrated power will be computed using this design prior instead of any design prior specified in the original rctbp_power_analysis object. Only valid when effect sizes vary (length > 1).

...

Additional arguments passed to plotly functions

Value

A plotly object for all plot types (power curves, heatmaps, and comparison plots)