# Pvalue for Spearman Correlation in julia

**URL:** <https://discourse.julialang.org/t/pvalue-for-spearman-correlation-in-julia/125824>\
**Category:** New to Julia\
**Tags:** question, hypothesis-tests\
**Created:** [February 12, 2025, 12:07pm UTC](https://discourse.julialang.org/t/pvalue-for-spearman-correlation-in-julia/125824 "2025-02-12T12:07:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [February 12, 2025, 12:07pm UTC](https://discourse.julialang.org/t/pvalue-for-spearman-correlation-in-julia/125824/1 "2025-02-12T12:07:19Z")

</div>

How to find correlation pvalue in case of spearman method?

For Pearson, it’s straightforward with function `CorrelationTest()` but I couldn’t find something similar for spearman.

---

<div class="post-metadata">

**Author:** ![eteppo](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@eteppo](https://discourse.julialang.org/u/eteppo)\
**Post date:** [February 12, 2025, 1:00pm UTC](https://discourse.julialang.org/t/pvalue-for-spearman-correlation-in-julia/125824/2 "2025-02-12T13:00:32Z")

</div>

While we wait for a proper answer, it may be equivalent to `tiedrank`ing your variables and then using `CorrelationTest`.

---

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [February 12, 2025, 1:12pm UTC](https://discourse.julialang.org/t/pvalue-for-spearman-correlation-in-julia/125824/3 "2025-02-12T13:12:15Z")

</div>

I think this is the only way. I don’t see any direct function.

It would be better to have `CorrelationTest()` with some `method` argument such as pearson, kendell or spearman etc. 🙂

---

<div class="post-metadata">

**Author:** ![b-lukaszuk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/b-lukaszuk/32/207730_2.png) [@b-lukaszuk](https://discourse.julialang.org/u/b-lukaszuk)\
**Post date:** [February 13, 2025, 2:02pm UTC](https://discourse.julialang.org/t/pvalue-for-spearman-correlation-in-julia/125824/4 "2025-02-13T14:02:12Z")

</div>

Hi. Yes, this is a little problematic.

I discussed a possible solution to it in my book. If you are interested here is Exercise 1 from ch07 ([Exercises - Association and Prediction - Romeo and Julia, where Romeo is Basic Statistics](https://b-lukaszuk.github.io/RJ_BS_eng/assoc_pred_exercises.html)) and the solution ([Solutions - Association - Romeo and Julia, where Romeo is Basic Statistics](https://b-lukaszuk.github.io/RJ_BS_eng/assoc_pred_exercises_solutions.html)).

Hope it will be helpful.
