# \donttest{
# Test homoscedastic case
## Generate some data
set.seed(2025)
N = 200
test_data =
data.frame(x1 = rep(letters[1:5],N/5))
test_data$outcome =
rnorm(N,-1 + 2 * (test_data$x1 %in% c("d","e")) )
## Fit the anova models
hetero_model =
aov_b(outcome ~ x1,
test_data)
homo_model =
aov_b(outcome ~ x1,
test_data,
heteroscedastic = FALSE)
## Perform test for heteroscedasticity using Bayes factors
heteroscedasticity_test(hetero_model,
homo_model)
# Test heteroscedastic case
## Generate some data
set.seed(2025)
N = 200
test_data =
data.frame(x1 = rep(letters[1:5],N/5))
test_data$outcome =
rnorm(N,
-1 + 2 * (test_data$x1 %in% c("d","e")),
sd = 3 - 2 * (test_data$x1 %in% c("d","e")))
## Fit the anova models
hetero_model =
aov_b(outcome ~ x1,
test_data)
homo_model =
aov_b(outcome ~ x1,
test_data,
heteroscedastic = FALSE)
## Perform test for heteroscedasticity using Bayes factors
heteroscedasticity_test(hetero_model,
homo_model)
# }
Run the code above in your browser using DataLab