Learn R Programming

powerbrmsINLA (version 1.1.1)

add_decision_overlay: Add sample-size decision overlay to an assurance contour

Description

Overlays the output of decide_sample_size() as a step-line on a contour plot (e.g. from plot_power_contour()).

Usage

add_decision_overlay(p, decisions, x_effect = NULL, colour = "red")

Value

A ggplot object.

Arguments

p

A ggplot object, typically from plot_power_contour().

decisions

A data.frame or tibble returned by decide_sample_size(), containing at least one effect column and n_recommended.

x_effect

Name of the effect column to use on the x-axis. If NULL, the first column that is not n_recommended or rationale is used.

colour

Colour for the overlay line (default "red").

Details

If the decisions contain multiple effect-grid columns, the overlay is aggregated over all effect columns except x_effect by taking the worst-case (maximum) recommended n at each value of x_effect.