plot_power_curve_ci: Plot the Power Curve with Bootstrap Confidence Band

View source: R/plot_power_curve_ci.R

plot_power_curve_ciR Documentation

Plot the Power Curve with Bootstrap Confidence Band

Description

Visualizes the isotonic power curve produced by sample_size_EGA_montecarlo() together with a 95 percent bootstrap band, the recommended sample size and its confidence interval as a bracket on the x axis, and (optionally) the empirical validation point.

Conceptually related to the bootstrap-spline plot in the powerly package (Constantin et al., 2023), but distinct in styling, color palette, annotations (bracket on the x axis, validation marker) and underlying object (combined power, not an arbitrary statistic).

Usage

plot_power_curve_ci(
  x,
  show_validation = TRUE,
  show_observed = TRUE,
  ribbon_alpha = 0.25,
  palette = c(median = "#2A6F4D", ribbon = "#7FB99B", accent = "#C25E2A"),
  ...
)

Arguments

x

Object returned by sample_size_EGA_montecarlo() run with recommendation_method = "interpolated".

show_validation

Logical; overlay the empirical power at the validation n (when validation_n_rep > 0 was used).

show_observed

Logical; overlay the observed (non-bootstrapped) power per grid point.

ribbon_alpha

Numeric in (0, 1); transparency of the bootstrap band.

palette

Character vector of length 3 with colors for: median curve, bootstrap band, validation/recommendation accents.

...

Ignored. For plot() compatibility.

Value

A ggplot object.

Examples

res <- sample_size_EGA_montecarlo(
  community_sizes = c(4, 4), within_edge = 0.20,
  sample_sizes = c(100, 200, 400), n_rep = 10,
  data_type = "continuous", seed = 1, verbose = FALSE,
  control = list(boots = 100, corr = "pearson", algorithm = "walktrap")
)
plot_power_curve_ci(res)

InterconectaR documentation built on Oct. 16, 2026, 1:06 a.m.