# sciPy stats.obrientransform() function | Python

scipy.stats.obrientransform(array) function computes the O’Brien transform on the given data. The main idea of using the O’Brien test is the transformation of original scores so that the transformed scores can reflect the variation of the original scores. An analysis of variance on this transformed scores will then tell differences in the variability (i.e., variance) of the original scores and therefore this analysis will test the homogeneity of variance assumption.

Its formula :

```N   = Number of observations
Ma  = Mean of the observations
SSa = Sum of the squares of observations
```

Parameters :
array : [array_like] number of arrays

Results : O’Brien transformation of the array

Code #1: Working

 `# stats.obrientransform() method    ` `import` `numpy as np ` `from` `scipy ``import` `stats ` `   `  `arr1 ``=` `[``20``, ``2``, ``7``, ``1``, ``34``] ` `arr2 ``=` `[``50``, ``12``, ``12``, ``34``, ``4``] ` ` `  `print` `(``"arr1 : "``, arr1) ` `print` `(``"\narr2 : "``, arr2) ` ` `  `print``(``"\n O Brien Transform : \n"``, stats.obrientransform(arr1, arr2))  ` ` `  `transform_arr1, transform_arr2 ``=` `stats.obrientransform(arr1, arr2) ` ` `  `print``(``"\n O Brien Transform of arr1: \n"``, transform_arr1)  ` `print``(``"\n O Brien Transform of arr2: \n"``, transform_arr2)  `

Output :

arr1 : [20, 2, 7, 1, 34]

arr2 : [50, 12, 12, 34, 4]

O Brien Transform :
[[ 42.65 137.15 16.10833333 170.10833333 622.48333333]
[1050.43333333 97.26666667 97.26666667 135.76666667 433.26666667]]

O Brien Transform of arr1:
[ 42.65 137.15 16.10833333 170.10833333 622.48333333]

O Brien Transform of arr2:
[1050.43333333 97.26666667 97.26666667 135.76666667 433.26666667]

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.