Open In App

sciPy stats.obrientransform() function | Python

Last Updated : 08 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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 :

obrien


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

Python3 1==
# 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]

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads