| plot_anova | R Documentation |
Creates a visualization of the sequential probability ratio test (SPRT) for ANOVA results, showing the log-likelihood ratio trajectory across sample sizes and decision boundaries.
plot_anova(
anova_results,
labels = TRUE,
position_labels_x = 0.15,
position_labels_y = 0.1,
position_lr_x = NULL,
position_lr_y = NULL,
font_size = 15,
line_size = 1,
highlight_color = "#CD2626"
)
anova_results |
A |
labels |
Logical. If |
position_labels_x |
Numeric value between 0 and 1 controlling the
horizontal position of decision labels as a proportion of maximum sample
size. Default is |
position_labels_y |
Numeric value controlling the vertical spacing
between decision boundaries and their labels. The value is multiplied by
|
position_lr_x |
Optional numeric value for the x-coordinate (sample size)
of the likelihood ratio label. If |
position_lr_y |
Optional numeric value for the y-coordinate
(log-likelihood ratio) of the likelihood ratio label. If |
font_size |
Numeric. Base font size for plot text. Default is |
line_size |
Numeric. Line width for the trajectory and boundaries.
Default is |
highlight_color |
Character string. Color for highlighting the decision
point or final sample. Default is |
A ggplot2::ggplot() object showing:
Log-likelihood ratio trajectory across sample sizes
Dashed horizontal lines indicating decision boundaries
Highlighted point showing where decision was reached (or final sample)
Optional labels for decision regions and likelihood ratio value
# simulate data for the example ------------------------------------------------
set.seed(3)
data <- sprtt::draw_sample_normal(3, f = 0.25, max_n = 50)
# calculate the SPRT -----------------------------------------------------------
anova_results <- sprtt::seq_anova(y~x, f = 0.25, data = data, plot = TRUE)
# plot the results -------------------------------------------------------------
# default settings
sprtt::plot_anova(anova_results)
# variant 1
sprtt::plot_anova(anova_results,
labels = TRUE,
position_labels_x = 0.05,
position_lr_x = 150,
position_lr_y = 0,
highlight_color = "green"
)
# variant 2
sprtt::plot_anova(anova_results,
labels = TRUE,
position_labels_x = 0.15,
position_labels_y = 0.2,
position_lr_x = 60,
position_lr_y = 1,
font_size = 25,
line_size = 2,
highlight_color = "darkred"
)
# no labels
sprtt::plot_anova(anova_results,
labels = FALSE
)
# custom additions
sprtt::plot_anova(anova_results) +
ggplot2::geom_vline(xintercept = 66, linewidth = 1, linetype = "dashed")
# further information ----------------------------------------------------------
# run this code:
vignette("one_way_anova", package = "sprtt")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.