Learn R Programming

powerbrmsINLA (version 1.1.1)

plot_interaction_surface: Plot Interaction Assurance Surface/Heatmap/Lines (Multi-Effect Grid Friendly)

Description

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.

Usage

plot_interaction_surface(
  data,
  metric,
  effect1,
  effect2,
  n = NULL,
  line = FALSE,
  facet_by = NULL,
  agg_fun = mean,
  title = NULL,
  subtitle = NULL
)

Value

A ggplot object.

Arguments

data

Data frame (typically power_results$summary).

metric

Name of the summary column to plot, e.g. "power_direction", "power_threshold".

effect1

Name of effect grid column for x-axis.

effect2

Name of effect grid column for y-axis or color/facets.

n

Optional sample size to filter to (else averages/plots all n's).

line

Logical; if TRUE, make a lineplot (effect1 on x, one line for each effect2). If FALSE, make a heatmap or contour.

facet_by

Optional grid column(s) to facet by.

agg_fun

Aggregation function if multiple entries per cell (default = mean).

title, subtitle

Optional plot labels.