[SciPy-Dev] Adding Z-test to scipy.stats

Ralf Gommers ralf.gommers at gmail.com
Sun Apr 11 15:27:41 EDT 2021


On Tue, Mar 30, 2021 at 2:53 PM Xingyu Liu <xingyuliu at g.harvard.edu> wrote:

> Hi everyone:
>
>
>
> I'm Xingyu Liu, a first year Data Science master student at Harvard
> University, and I'm thinking of adding Z-test to scipy.stats.
>
>
>
> Z-test is one of the most basic types of hypothesis test and is covered in
> almost all the statistics textbooks (e.g. *Statistics* by David Freedman,
> et,al.) . However, currently, Z-test is not implemented in scipy(see this
> feature request issue https://github.com/scipy/scipy/issues/13662  ). Its
> principles are quite similar to t-test except that it uses the population
> variance rather than the sample variance for calculation, which means that
> the population variance shoud be known in advance. In application, Z-test
> is used when sample size is large (n>50), or the population variance is
> known; t-test is used when sample size is small (n<50) and population
> variance is unknown(https://en.wikipedia.org/wiki/Z-test).
>
>
>
> There are mainly three types of Z-test and the coding part can be quite
> similar to t-test:
>
> 1. One Sample Z-Test: Does the mean of the sample differ from the expected
> mean?
>
> 2. Two Independent Sample Z-Test: Do the means of two independent samples
> differ?
>
> 3. Paired-Sample Z-Test: Do the means of the same sample differ before and
> after?
>
>
>
> Do you think it would be helpful to do this enhancement? If it is, I can
> work on it :)
>

Thanks for proposing this Xingyu. There are multiple papers with 200+
citations on the Z-test, including modified and weighted variants. So it's
probably justified to include it in scipy.stats. That said, there's no one
who responded to this saying they want/need this, so it's not very high
priority. Adding it to the end of your GSoC proposal in case you have time
left seems like the right thing to do here.

Cheers,
Ralf



>
> Cheers,
>
> Xingyu
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/scipy-dev/attachments/20210411/9fa13e77/attachment-0001.html>


More information about the SciPy-Dev mailing list