Perform Bartlett's test for equality of variances¶
Source: man/performBartlettTest.Rd · Help: ?performBartlettTest
Uses bartlett.test on model residuals grouped by a factor.
Usage¶
Arguments¶
model- an object of class
lm. data- data frame used to fit
model. WhenNULL, the default, the model frame ofmodelis used, sogroupmust then be a variable of the model. The model frame holds the terms of the model rather than its variables (log(x)rather thanx), so a model that transforms a variable needsdata, as does a model with anoffset()term. group- name of the grouping variable.
Value¶
An object of class htest containing the chi-squared statistic, p-value and degrees of freedom.
Details¶
The test statistic compares the pooled variance to the individual group variances. It is computed as \(\chi^2 = (N - k) \ln S_p^2 - \sum (n_i - 1) \ln s_i^2\), where \(S_p^2\) is the pooled variance and \(s_i^2\) the group variances. Under the null it approximates a chi-square distribution with \(k-1\) degrees of freedom.
References¶
Bartlett, M. S. (1937). Properties of sufficiency and statistical tests. Proceedings of the Royal Society of London, 160(901), 268–282. doi:10.1098/rspa.1937.0109
Hartley, H. O. (1950). The maximum F-ratio as a short-cut test for heterogeneity of variance. Biometrika, 37(3/4), 308–312. doi:10.2307/2332383