Skip to content

Perform O'Brien test for equality of variances

Source: man/performOBrienTest.Rd · Help: ?performOBrienTest

Implements O'Brien's observation-level transformed-residual test for equality of group variances.

Usage

performOBrienTest(model, data = NULL, group)

Arguments

model
A fitted lm object.
data
Data frame used to fit model and containing the grouping variable. When NULL, the default, the model frame of model is used, so group must then be a variable of the model. The model frame holds the terms of the model rather than its variables (log(x) rather than x), so a model that transforms a variable needs data, as does a model with an offset() term.
group
Grouping variable name.

Value

An object of class htest containing the F statistic, numerator and denominator degrees of freedom, and p-value.

Details

For each residual within a group, O'Brien's transformation combines its squared deviation from the group mean with the group's sample variance and sample size. A one-way ANOVA of those transformed observations yields an approximate \(F_{k-1,N-k}\) test. Every group must contain at least three observations.

References

O'Brien, R. G. (1981). A simple test for variance effects in experimental designs. Psychological Bulletin, 89(3), 570–574.

Examples

 set.seed(1702)
 n <- 25
 d <- data.frame(g = factor(rep(letters[1:3], each = n)), x = rnorm(3 * n))
 d$y <- 2 + d$x + rnorm(3 * n, sd = rep(c(1, 1, 1.8), each = n))
 m <- lm(y ~ x, data = d)
 performOBrienTest(m, d, "g")