Skip to contents

Creates a line plot showing how a performance metric varies with a parameter axis (e.g., cluster separation). Useful for exploring parameter sensitivity.

Usage

plot_metric_vs_axis(
  aggregated_df,
  metric = "ARI",
  axis = "cluster_sep_spatial",
  facet_by = "model_type",
  color_by = "Method",
  show_error_bars = TRUE
)

Arguments

aggregated_df

Data frame with aggregated results from run_param_sweep(). Must contain columns: Method, model_type, the specified metric columns (metric_mean, metric_sd), and the specified axis column.

metric

Character. Metric to plot. One of "ARI", "VAF", "BIC", "SSE". Default is "ARI".

axis

Character. Parameter axis to plot on x-axis. One of "cluster_sep_spatial", "cluster_sep_temporal", "cluster_sep_stability", "N", "K", "r". Default is "cluster_sep_spatial".

facet_by

Character. Variable to facet by. One of "model_type" or "Method". Default is "model_type".

color_by

Character. Variable to color by. One of "Method" or "model_type". Default is "Method".

show_error_bars

Logical. Whether to show error bars (mean +/- sd). Default is TRUE.

Value

A ggplot2 object

Examples

if (FALSE) { # \dontrun{
library(synergyMixR)
results <- run_param_sweep(test = TRUE, cores = 2)

# Plot ARI vs spatial separation
p1 <- plot_metric_vs_axis(
  results$aggregated_results,
  metric = "ARI",
  axis = "cluster_sep_spatial"
)
print(p1)

# Plot VAF vs temporal separation
p2 <- plot_metric_vs_axis(
  results$aggregated_results,
  metric = "VAF",
  axis = "cluster_sep_temporal"
)
print(p2)
} # }