| seq_anova | R Documentation |
Performs a sequential one-way fixed effects ANOVA, which is a variant of a Sequential Probability Ratio Test (SPRT). The test allows for continuous monitoring of data collection and provides stopping boundaries based on likelihood ratios, offering efficiency gains over traditional fixed-N designs.
The sequential ANOVA continuously evaluates the likelihood ratio after each observation (or group of observations), stopping when sufficient evidence accumulates for either H0 or H1.
For methodological details, see Steinhilber et al. (2024)
doi:10.1037/met0000677. For practical guidance, see
vignette("one_way_anova", package = "sprtt").
seq_anova(
formula,
f,
alpha = 0.05,
power = 0.95,
data,
verbose = TRUE,
plot = FALSE,
seq_steps = "single"
)
formula |
A formula specifying the model (e.g., |
f |
Cohen's f (expected minimal effect size or effect size of interest), that defines the H1. |
alpha |
Type I error rate (alpha level). The probability of rejecting H0 when it is true. Default is 0.05. Must be between 0 and 1. |
power |
Statistical power (1 - beta), where beta is the Type II error rate. The probability of correctly rejecting H0 when H1 is true with effect size f. Default is 0.95. Must be between 0 and 1. Higher values lead to wider stopping boundaries and potentially larger sample sizes. |
data |
A data frame containing the variables specified in the formula. Missing values (NA) will be removed with a warning |
verbose |
a logical value whether you want a verbose output or not. |
plot |
Logical. If |
seq_steps |
Specifies when to calculate test statistics during sequential
testing (only relevant when
For unbalanced designs or non-standard sequences, specify custom steps as a vector. |
An object of the S4 class seq_anova_results. Click on the
class link to see the full description of the slots.
To get access to the object use the
@-operator or []-brackets instead of $.
See the examples below.
Only one-way fixed effects ANOVA is currently supported
Repeated measures ANOVA is not yet implemented
plot_anova() for visualizing sequential ANOVA results
plan_sample_size() for sample size planning
seq_ttest() for sequential t-tests
vignette("one_way_anova", package = "sprtt") for detailed tutorial
vignette("plan_sample_size", package = "sprtt") for planning guidance
Steinhilber et al. (2023) for theoretical background
# simulate data ----------------------------------------------------------------
set.seed(333)
data <- sprtt::draw_sample_normal(k_groups = 3,
f = 0.25,
sd = c(1, 1, 1),
max_n = 50)
# calculate sequential ANOVA ---------------------------------------------------
results <- sprtt::seq_anova(y ~ x, f = 0.25, data = data)
# test decision
results@decision
# test results
results
# calculate sequential ANOVA ---------------------------------------------------
results <- sprtt::seq_anova(y ~ x,
f = 0.25,
data = data,
alpha = 0.01,
power = .80,
verbose = TRUE)
results
# calculate sequential ANOVA ---------------------------------------------------
results <- sprtt::seq_anova(y ~ x,
f = 0.15,
data = data,
alpha = 0.05,
power = .80,
verbose = FALSE)
results
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.