# How do I extract more than a pvalue HypothesisTests.jl?

**URL:** <https://discourse.julialang.org/t/how-do-i-extract-more-than-a-pvalue-hypothesistests-jl/120703>\
**Category:** Statistics\
**Tags:** question, package, hypothesis-tests\
**Created:** [September 30, 2024, 12:12am UTC](https://discourse.julialang.org/t/how-do-i-extract-more-than-a-pvalue-hypothesistests-jl/120703 "2024-09-30T00:12:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rosejoycrocker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rosejoycrocker/32/212329_2.png) [@Rosejoycrocker](https://discourse.julialang.org/u/Rosejoycrocker)\
**Post date:** [September 30, 2024, 12:12am UTC](https://discourse.julialang.org/t/how-do-i-extract-more-than-a-pvalue-hypothesistests-jl/120703/1 "2024-09-30T00:12:00Z")

</div>

Hi,  
I’m using HypothesisTests.jl to do a series of 2 Sample Kolmogorov Smirnov tests. This means I’m looping through a large series of data sets and applying the test `KS_object = ApproximateTwoSampleKSTest(data_set1, data_set2)` . I need to be able to store the KS statistic as I loop through the datasets but I can’t see how to do this. If I look at `fieldnames(typeof(KS_object))` , the KS stat is not stored in the fieldnames. I also can’t use the `pvalue` function as this is not what I want to extract. Any advice appreciated, the docs don’t have any examples for this test.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [September 30, 2024, 7:50am UTC](https://discourse.julialang.org/t/how-do-i-extract-more-than-a-pvalue-hypothesistests-jl/120703/3 "2024-09-30T07:50:29Z")

</div>

You can see what the test is showing you here:

> <https://github.com/JuliaStats/HypothesisTests.jl/blob/master/src/kolmogorov_smirnov.jl#L172>

To see:

```julia
julia> x = ApproximateTwoSampleKSTest(rand(10), rand(10))
Approximate two sample Kolmogorov-Smirnov test
----------------------------------------------
Population details:
    parameter of interest: Supremum of CDF differences
    value under h_0: 0.0
    point estimate: 0.5

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

Details:
    number of observations: [10,10]
    KS-statistic: 1.118033988749895

julia> n = x.n_x*x.n_y/(x.n_x+x.n_y)
5.0

julia> √(n)*x.δ
1.118033988749895

```
