Compute the O’Brien transform on input data (any number of arrays).
Used to test for homogeneity of variance prior to running one-way stats. Each array in
*argsis one level of a factor. If
f_onewayis run on the transformed data and found significant, the variances are unequal. From Maxwell and Delaney , p.112.
- argstuple of array_like
Any number of arrays.
Transformed data for use in an ANOVA. The first dimension of the result corresponds to the sequence of transformed arrays. If the arrays given are all 1-D of the same length, the return value is a 2-D array; otherwise it is a 1-D array of type object, with each element being an ndarray.
S. E. Maxwell and H. D. Delaney, “Designing Experiments and Analyzing Data: A Model Comparison Perspective”, Wadsworth, 1990.
We’ll test the following data sets for differences in their variance.
>>> x = [10, 11, 13, 9, 7, 12, 12, 9, 10] >>> y = [13, 21, 5, 10, 8, 14, 10, 12, 7, 15]
Apply the O’Brien transform to the data.
>>> from scipy.stats import obrientransform >>> tx, ty = obrientransform(x, y)
scipy.stats.f_onewayto apply a one-way ANOVA test to the transformed data.
>>> from scipy.stats import f_oneway >>> F, p = f_oneway(tx, ty) >>> p 0.1314139477040335
If we require that
p < 0.05for significance, we cannot conclude that the variances are different.