question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ks_2samp: example description does not match example output

See original GitHub issue

The text describing the example no longer matches the output of the code.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ks_2samp.html https://github.com/scipy/scipy/blob/master/scipy/stats/stats.py#L7454

For a slightly different distribution, we cannot reject the null hypothesis at a 10% or lower alpha since the p-value at 0.144 is higher than 10%

rvs3 = stats.norm.rvs(size=n2, loc=0.01, scale=1.0, random_state=rng)
stats.ks_2samp(rvs1, rvs3)
KstestResult(statistic=0.07833333333333334, pvalue=0.4379658456442945)

This is a regression, a much earlier version is correct: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.ks_2samp.html

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
rkerncommented, Jun 29, 2021

As long as the seeds are large (128 bits), I don’t mind that approach. I’m not too concerned about people literally copy-pasting the examples (so I don’t care to have an explicit warning) so much as seeing every example with tiny seeds. The cumulative effect of every example with seed=0 or seed=1234 has had a bad effect on production code, I think.

0reactions
mdhabercommented, Mar 12, 2022

The original issue was fixed by gh-15651.

Read more comments on GitHub >

github_iconTop Results From Across the Web

scipy.stats.ks_2samp — SciPy v1.9.3 Manual
Performs the two-sample Kolmogorov-Smirnov test for goodness of fit. This test compares the underlying continuous distributions F(x) and G(x) of two independent ...
Read more >
Kolmogorov-Smirnov (ks_2samp) p-value not as expected ...
A difficulty with the Kolmogorov-Smirnov test, used with large sample sizes, is that small, unimportant differences between two samples are ...
Read more >
Two-sample Kolmogorov-Smirnov Test in Python Scipy
If the K-S statistic is small or the p-value is high, then we cannot reject the hypothesis that the distributions of the two...
Read more >
Kolmogorov-Smirnov 2-Sample Goodness of Fit Test
Purpose: Perform a Kolmogorov-Smirnov two sample test that two data samples come from the same distribution. Note that we are not specifying ...
Read more >
result mismatch between sp.stats.mstats.ks_twosamp ... - GitHub
Computes the Kolmogorov-Smirnov test on two samples. Missing values in `x` and/or `y` are discarded.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found