Visualizes a metric (e.g., assurance) as a function of two effect grid variables for a fixed sample size or averaged over n. Allows line, heatmap, or contour modes.
plot_interaction_surface(
data,
metric,
effect1,
effect2,
n = NULL,
line = FALSE,
facet_by = NULL,
agg_fun = mean,
title = NULL,
subtitle = NULL
)A ggplot object.
Data frame (typically power_results$summary).
Name of the summary column to plot, e.g. "power_direction", "power_threshold".
Name of effect grid column for x-axis.
Name of effect grid column for y-axis or color/facets.
Optional sample size to filter to (else averages/plots all n's).
Logical; if TRUE, make a lineplot (effect1 on x, one line for each effect2). If FALSE, make a heatmap or contour.
Optional grid column(s) to facet by.
Aggregation function if multiple entries per cell (default = mean).
Optional plot labels.