# NOT RUN {
# for reproducibility
set.seed(123)
library(statsExpressions)
# ----------------------- parametric -------------------------------------
# between-subjects
expr_oneway_anova(
data = ggplot2::msleep,
x = vore,
y = sleep_rem
)
# within-subjects design
expr_oneway_anova(
data = iris_long,
x = condition,
y = value,
subject.id = id,
paired = TRUE,
output = "dataframe"
)
# ----------------------- non-parametric ----------------------------------
# between-subjects
expr_oneway_anova(
data = ggplot2::msleep,
x = vore,
y = sleep_rem,
type = "np"
)
# within-subjects design
expr_oneway_anova(
data = iris_long,
x = condition,
y = value,
subject.id = id,
paired = TRUE,
type = "np",
output = "dataframe"
)
# ----------------------- robust -------------------------------------
# between-subjects
expr_oneway_anova(
data = ggplot2::msleep,
x = vore,
y = sleep_rem,
type = "r"
)
# within-subjects design
expr_oneway_anova(
data = iris_long,
x = condition,
y = value,
subject.id = id,
paired = TRUE,
type = "r",
output = "dataframe"
)
# ----------------------- Bayesian -------------------------------------
# between-subjects
expr_oneway_anova(
data = ggplot2::msleep,
x = vore,
y = sleep_rem,
type = "bayes"
)
# within-subjects design
# needs `BayesFactor 0.9.12-4.3` or above
if (utils::packageVersion("BayesFactor") >= package_version("0.9.12-4.3")) {
expr_oneway_anova(
data = iris_long,
x = condition,
y = value,
subject.id = id,
paired = TRUE,
type = "bayes",
output = "dataframe"
)
}
# }
Run the code above in your browser using DataLab