计算Jonckheere Terpsera趋势检验Python代码
要p值和Z值
直接来
import scipy.stats as stats
import numpy as np
# 假设有3组数据,每组数据有4个样本
x = np.array([[1,2,3,4],
[3,4,5,6],
[5,6,7,8]])
# 计算Jonckheere Terpsera趋势检验
z, p = stats.jt(x[0], x[1], x[2])
print('Z值: %.2f' % z)
print('P值: %.5f' % p)
§ Output
> stdout : ['Z值: 1.73\n', 'P值: 0.08294\n']