import scipy
import statsmodels
def ttest_onesided(A, B, equal_var= False):
(t, p) = scipy.stats.ttest_ind(A, B, equal_var= False)
if t > 0:
onesided_p = 1 - p / 2
else:
onesided_p = p / 2
return onesided_p
def ztest_onesided(A, B):
(t, p) = statsmodels.stats.weightstats.ztest(A, B)
if t > 0:
onesided_p = 1 - p / 2
else:
onesided_p = p / 2
return onesided_p
python 单边t检验 z检验 ttest ztest
最新推荐文章于 2024-04-08 16:23:08 发布