# NOT RUN {
# using grouping variable
model <- lm(mpg ~ disp + hp, data = mtcars)
resid <- residuals(model)
cyl <- as.factor(mtcars$cyl)
ols_bartlett_test(resid, group_var = cyl)
# }
# NOT RUN {
# }
# NOT RUN {
# using variables
ols_bartlett_test(hsb$read, hsb$write)
# }
# NOT RUN {
# }
# NOT RUN {
# using formula
mt <- mtcars
mt$cyl <- as.factor(mt$cyl)
ols_bartlett_test(mpg ~ cyl, data = mt)
# }
# NOT RUN {
# }
# NOT RUN {
# using model
model <- lm(mpg ~ cyl, data = mt)
ols_bartlett_test(model)
# }
Run the code above in your browser using DataLab