sciPy stats.obrientransform()函数| Python
scipy.stats.obrientransform(array)函数计算给定数据的O'Brien 变换。使用 O'Brien 测试的主要思想是对原始分数进行变换,使变换后的分数能够反映原始分数的变化。然后对该转换分数的方差分析将说明原始分数的可变性(即方差)的差异,因此该分析将测试方差假设的同质性。
其公式:
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
代码 #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)
输出 :
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]