statsmodels.stats.weightstats._tstat_generic

statsmodels.stats.weightstats._tstat_generic(value1, value2, std_diff, dof, alternative, diff=0)[source]

基于汇总统计的通用t检验

The test statistic is :

tstat = (value1 - value2 - diff) / std_diff

并且假设其服从自由度为 dof 的 t 分布。

Parameters:
value1float or ndarray

第一个样本的值,例如均值。

value2float or ndarray

第二个样本的值,例如均值。

std_difffloat or ndarray

差值 value1 - value2 的标准误差

dofint or float

自由度

alternativestr

备择假设,H1,必须是以下之一

  • ‘双侧’ : H1: value1 - value2 - diff 不等于 0。

  • ‘larger’ : H1: value1 - value2 - diff > 0

  • ‘较小’ : H1: value1 - value2 - diff < 0

difffloat

在零假设下,差异值 value1 - value2

Returns:
tstatfloat or ndarray

测试统计量。

pvaluefloat or ndarray

假设检验统计量服从自由度为 df 的 t 分布的假设检验的 P 值。


Last update: Oct 16, 2024