bundles / scipy 1.17.1 / scipy / stats / _stats_py / obrientransform
function
scipy.stats._stats_py:obrientransform
source: /scipy/stats/_stats_py.py :2505
Signature
def obrientransform ( * samples ) Summary
Compute the O'Brien transform on input data (any number of arrays).
Extended Summary
Used to test for homogeneity of variance prior to running one-way stats. Each array in *samples is one level of a factor. If f_oneway is run on the transformed data and found significant, the variances are unequal. From Maxwell and Delaney [1], p.112.
Parameters
sample1, sample2, ...: array_likeAny number of arrays.
Returns
obrientransform: ndarrayTransformed 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.
Raises
: ValueErrorIf the mean of the transformed data is not equal to the original variance, indicating a lack of convergence in the O'Brien transform.
Notes
Array API Standard Support
obrientransform has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.
==================== ==================== ==================== Library CPU GPU ==================== ==================== ==================== NumPy ✅ n/a CuPy n/a ⛔ PyTorch ⛔ ⛔ JAX ⛔ ⛔ Dask ⛔ n/a ==================== ==================== ====================
See
dev-arrayapifor more information.
Examples
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]✓
from scipy.stats import obrientransform tx, ty = obrientransform(x, y)✓
from scipy.stats import f_oneway F, p = f_oneway(tx, ty)✓
p
✗Aliases
-
scipy.stats.obrientransform