plot_bootstrap: Bootstrap Coefficient Comparison Plot

View source: R/plot.R

plot_bootstrapR Documentation

Bootstrap Coefficient Comparison Plot

Description

Displays faceted line plots comparing real (bootstrapped) vs null (permuted) coefficient trajectories across tasks for selected or all features. Each panel shows the mean and standard error of the coefficient at each task/threshold.

Usage

plot_bootstrap(x, features = NULL, batch_size = 9)

Arguments

x

Either a "bootstrap_orthoMTL" object (as returned by bootstrap_orthoMTL) or a data.frame with columns id, time, coeff, and group.

features

A character vector of feature names to plot. If NULL (default), all features are plotted.

batch_size

Number of features per facet page. Default: 9.

Details

Blue lines show coefficients from models fitted on bootstrapped (resampled) data — reflecting estimation variability under real signal. Grey lines show coefficients from models fitted on permuted outcomes — reflecting the null distribution.

When the blue (real) band is clearly separated from the grey (null) band, the feature's coefficient is distinguishable from noise at that task/threshold.

Value

A list of ggplot2 objects, one per batch/page.

See Also

bootstrap_orthoMTL

Examples


set.seed(42)
n <- 30; p <- 5; n_tasks <- 3
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- paste0("V", seq_len(p))
SurvTime <- rexp(n, rate = 0.1)
Event <- rbinom(n, 1, 0.7)
thresholds <- c(4, 6, 10)
Y <- create_longitudinal_labels(SurvTime, Event, thresholds)
W <- create_indicator_matrix(Y)
K <- create_constraint_matrix(n_tasks)
boot_res <- bootstrap_orthoMTL(
  X = X, Y = Y, lambda = 1e-3, step_size = 0.1,
  K = K, survival = TRUE, censored.mat = W,
  n_repeats = 5, n_cores = 1, verbose = FALSE
)
plots <- plot_bootstrap(boot_res)
plots[[1]]


orthoMTL documentation built on Aug. 23, 2026, 5:10 p.m.