stats.weightstats.ztest()

statsmodels.stats.weightstats.ztest

statsmodels.stats.weightstats.ztest(x1, x2=None, value=0, alternative='two-sided', usevar='pooled', ddof=1.0) [source]

test for mean based on normal distribution, one or two samples

In the case of two samples, the samples are assumed to be independent.

Parameters:

x1, x2 : array_like, 1-D or 2-D

two independent samples

value : float

In the one sample case, value is the mean of x1 under the Null hypothesis. In the two sample case, value is the difference between mean of x1 and mean of x2 under the Null hypothesis. The test statistic is x1_mean - x2_mean - value.

alternative : string

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

?two-sided?: H1: difference in means not equal to value (default) ?larger? : H1: difference in means larger than value ?smaller? : H1: difference in means smaller than value

usevar : string, ?pooled?

Currently, only ?pooled? is implemented. If pooled, then the standard deviation of the samples is assumed to be the same. see CompareMeans.ztest_ind for different options.

ddof : int

Degrees of freedom use in the calculation of the variance of the mean estimate. In the case of comparing means this is one, however it can be adjusted for testing other statistics (proportion, correlation)

Returns:

tstat : float

test statisic

pvalue : float

pvalue of the t-test

Notes

usevar not implemented, is always pooled in two sample case use CompareMeans instead.

doc_statsmodels
2017-01-18 16:19:51
Comments
Leave a Comment

Please login to continue.