plot_failure_decomposition: Plot Replication-Level Failure Decomposition Per Sample Size

View source: R/plot_failure_decomposition.R

plot_failure_decompositionR Documentation

Plot Replication-Level Failure Decomposition Per Sample Size

Description

Stacked-bar visualization showing what fraction of Monte Carlo replications fails each constraint at every sample size. The bars decompose 1 - power_combined into mutually exclusive failure modes (in priority order): non-convergence, incorrect dimension recovery, and one bar per target metric whose threshold was not met. The complementary green segment shows the success rate (power_combined).

This is an original visualization (not present in powerly) intended to diagnose which constraint is the bottleneck at low n: e.g., is it convergence, dimension recovery, or a specific recovery target?

Usage

plot_failure_decomposition(x, order_targets = NULL, ...)

Arguments

x

Object returned by sample_size_EGA_montecarlo().

order_targets

Optional character vector reordering the failure-mode priorities for the metric targets. The default order is convergence -> dimensions -> targets in the order they appear in x$targets -> success.

...

Ignored.

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_failure_decomposition(res)

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