man/examples/examples-oneway-anova.R

# for reproducibility
set.seed(123)
library(statsExpressions)

# ----------------------- parametric -------------------------------------

# between-subjects
oneway_anova(
  data = mtcars,
  x = cyl,
  y = wt
)

# biased (partial eta-squared) effect size
oneway_anova(
  data = mtcars,
  x = cyl,
  y = wt,
  effsize.type = "eta"
)

# within-subjects design
oneway_anova(
  data = bugs_long,
  x = condition,
  y = desire,
  subject.id = subject,
  paired = TRUE
)

# ----------------------- non-parametric ----------------------------------

# between-subjects
oneway_anova(
  data = mtcars,
  x = cyl,
  y = wt,
  type = "np"
)

# within-subjects design
oneway_anova(
  data = bugs_long,
  x = condition,
  y = desire,
  subject.id = subject,
  paired = TRUE,
  type = "np"
)

# ----------------------- robust -------------------------------------

# between-subjects
oneway_anova(
  data = mtcars,
  x = cyl,
  y = wt,
  type = "r"
)

# within-subjects design
oneway_anova(
  data = bugs_long,
  x = condition,
  y = desire,
  subject.id = subject,
  paired = TRUE,
  type = "r"
)

# ----------------------- Bayesian -------------------------------------

# between-subjects
oneway_anova(
  data = mtcars,
  x = cyl,
  y = wt,
  type = "bayes"
)

# within-subjects design
oneway_anova(
  data = bugs_long,
  x = condition,
  y = desire,
  subject.id = subject,
  paired = TRUE,
  type = "bayes"
)

Try the statsExpressions package in your browser

Any scripts or data that you put into this service are public.

statsExpressions documentation built on Oct. 17, 2026, 9:06 a.m.