HypothesisTests.jl icon indicating copy to clipboard operation
HypothesisTests.jl copied to clipboard

ExactOneSampleKSTest rejects hypothesis incorrectly

Open GHTaarn opened this issue 3 years ago • 4 comments

The following code results in h_0 being rejected even though the sample was carefully chosen to match the distribution:

using HypothesisTests, Distributions
n = 50
x = 0.5 .^ (1:n)
d = DiscreteNonParametric(1:n, x ./ sum(x))
sample = vcat(ones(Int64,16), 2*ones(Int64,8), 3*ones(Int64,4), 4,4,5)
display(ExactOneSampleKSTest(sample, d))

In https://discourse.julialang.org/t/komolgorov-smirnov-test/89990/6 a person also found a big difference between results obtained with ApproximateTwoSampleKSTest and those obtained with scipy stats.

GHTaarn avatar Nov 10 '22 05:11 GHTaarn

I'm having the same issue with ApproximateTwoSampleKSTest and continuous distributions, where scipy.stats.kstest gives the correct answer.

jtackm avatar Feb 15 '23 09:02 jtackm

Hey, I posted on this too a while back, I see a pretty big difference between this package and what I get out of R...anybody have any clue which one is right?

johnabs avatar Jul 02 '23 07:07 johnabs

Also, I just compared the test statistic values to R and Mathematica (which are in agreement), and this package produces results which differ. What's the deal?

johnabs avatar Jul 02 '23 15:07 johnabs

@simonbyrne You approved https://github.com/JuliaStats/HypothesisTests.jl/pull/29 ten years ago. ;-) Do you have any idea what may be going on?

nalimilan avatar Apr 29 '25 20:04 nalimilan