statsmodels.stats.weightstats._zstat_generic

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

generic (normal) z-test based on summary statistic

The test statistic is :

tstat = (value1 - value2 - diff) / std_diff

and is assumed to be normally distributed.

Parameters:
value1float or ndarray

Value, for example mean, of the first sample.

value2float or ndarray

Value, for example mean, of the second sample.

std_difffloat or ndarray

Standard error of the difference value1 - value2

alternativestr

The alternative hypothesis, H1, has to be one of the following

  • ‘two-sided’ : H1: value1 - value2 - diff not equal to 0.

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

  • ‘smaller’ : H1: value1 - value2 - diff < 0

difffloat

value of difference value1 - value2 under the null hypothesis

Returns:
tstatfloat or ndarray

Test statistic.

pvaluefloat or ndarray

P-value of the hypothesis test assuming that the test statistic is t-distributed with df degrees of freedom.


Last update: Nov 14, 2024