Skip to content
Related Articles

Related Articles

Improve Article

sciPy stats.obrientransform() function | Python

  • Last Updated : 18 Feb, 2019

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]

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :