seq_anova {sprtt}R Documentation

Sequential Analysis of Variance

Description

[Experimental]

Performs a sequential one-way fixed effects ANOVA, see Steinhilber et al. (2023) doi:10.31234/osf.io/m64ne for more information.

Usage

seq_anova(
  formula,
  f,
  alpha = 0.05,
  power = 0.95,
  data,
  verbose = TRUE,
  plot = FALSE,
  seq_steps = "single"
)

Arguments

formula

A formula specifying the model.

f

Cohen's f (expected minimal effect size or effect size of interest).

alpha

the type I error. A number between 0 and 1.

power

1 - beta (beta is the type II error probability). A number between 0 and 1.

data

A data frame in which the variables specified in the formula will be found.

verbose

a logical value whether you want a verbose output or not.

plot

calculates the ANOVA sequentially on the data and saves the results in the slot called plot. This calculation is necessary for the plot_anova() function.

seq_steps

Defines the sequential steps for the sequential calculation if plot = TRUE. Argument takes either a vector of numbers or the argument single or balanced. A vector of numbers specifies the sample sizes at which the anova is calculated. single specifies that after each single point the test statistic is calculated (step size = 1). Attention: the calculation starts at the number of groups times two. If the data do not fit to this, you have to specify the sequential steps yourself in this argument. balanced specifies that the step size is equal to the number of groups. Attention: the calculation starts at the number of groups times two.

Value

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.

Examples

# 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

[Package sprtt version 0.2.0 Index]