2
$\begingroup$

I am comparing a selection of values which come from a non-normal distribution to 0. I've done a wilcoxon in python:

result = scipy.stats.wilcoxon(values)

my W is positive and huge (> 10000) and my p value is < .001.

My question is how do I tell which of my two tails the data is in? Is it sufficient to just check their means/medians or?

$\endgroup$

1 Answer 1

1
$\begingroup$

The reference for the function can be found here: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wilcoxon.html

They recommend using the function a second time for a one-sided test as in

from scipy.stats import wilcoxon
d = [6, 8, 14, 16, 23, 24, 28, 29, 41, -48, 49, 56, 60, -67, 75]

w, p = wilcoxon(d, alternative='greater')

The possible values for alternative are {“two-sided”, “greater”, “less”}

$\endgroup$
2
  • $\begingroup$ Working in an environment where I'm not allowed to be past scipy 1.2.1 at work. This isn't an option in the old scipy and I was wondering if there's any way to just interpret it from the result? $\endgroup$ Oct 17, 2019 at 15:07
  • 1
    $\begingroup$ The return value statistics is the sum of the ranks of the differences above or below zero, whichever is smaller. "Whichever is smaller" erases the information you seek. Writing your own function to compute the ranks of values above or below zero should be doable, if you can find no better function in scipy. scipy.stats.rankdata can produce the ranks, which you will then have to filter and sum. $\endgroup$
    – Bernhard
    Oct 17, 2019 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.