{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "6dac65c4",
            "cell_type": "markdown",
            "source": "<div class='alert alert-warning'>\n\nSciPy's interactive examples with Jupyterlite are experimental and may not always work as expected. Execution of cells containing imports may result in large downloads (up to 60MB of content for the first import from SciPy). Load times when importing from SciPy may take roughly 10-20 seconds. If you notice any problems, feel free to open an [issue](https://github.com/scipy/scipy/issues/new/choose).\n\n</div>",
            "metadata": {}
        },
        {
            "id": "1c4a5f89",
            "cell_type": "markdown",
            "source": "We can test the hypothesis that two independent unequal-sized samples are\ndrawn from the same distribution with computing the Wilcoxon rank-sum\nstatistic.\n",
            "metadata": {}
        },
        {
            "id": "6e24f864",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy.stats import ranksums\nrng = np.random.default_rng()\nsample1 = rng.uniform(-1, 1, 200)\nsample2 = rng.uniform(-0.5, 1.5, 300) # a shifted distribution\nranksums(sample1, sample2)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "RanksumsResult(statistic=-7.887059,\n               pvalue=3.09390448e-15) # may vary"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "2ac0c781",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "ranksums(sample1, sample2, alternative='less')",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "RanksumsResult(statistic=-7.750585297581713,\n               pvalue=4.573497606342543e-15) # may vary"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "64d3b2bc",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "ranksums(sample1, sample2, alternative='greater')",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "RanksumsResult(statistic=-7.750585297581713,\n               pvalue=0.9999999999999954) # may vary"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "d28f714d",
            "cell_type": "markdown",
            "source": "The p-value of less than ``0.05`` indicates that this test rejects the\nhypothesis at the 5% significance level.",
            "metadata": {}
        }
    ]
}