1

I need to compare two data sets, i randomly created them in Julia, with rand. I want to know if there's some statistical test (that can be perform in Julia JuMP) that tells me how different the distributions are (having no assumptions of the original distribution).

jvm.97
  • 247
  • 1
  • 7

1 Answers1

4

Why would you want to perform this in JuMP?

This is really a job for the HypothesisTests package: https://github.com/JuliaStats/HypothesisTests.jl

julia> using HypothesisTests

julia> x, y = rand(100), rand(100);

julia> test = HypothesisTests.ApproximateTwoSampleKSTest(x, y)
Approximate two sample Kolmogorov-Smirnov test
----------------------------------------------
Population details:
    parameter of interest:   Supremum of CDF differences
    value under h_0:         0.0
    point estimate:          0.11

Test summary:
    outcome with 95% confidence: fail to reject h_0
    two-sided p-value:           0.5806

Details:
    number of observations:   [100,100]
    KS-statistic:              0.7778174593052022


julia> pvalue(test)
0.5806177304235198

https://juliastats.org/HypothesisTests.jl/stable/nonparametric/#HypothesisTests.ApproximateTwoSampleKSTest

Oscar Dowson
  • 2,395
  • 1
  • 5
  • 13