{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "f4c41c44",
            "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": "a4849735",
            "cell_type": "markdown",
            "source": "Test whether the lists `a`, `b` and `c` come from populations\nwith equal variances.\n",
            "metadata": {}
        },
        {
            "id": "9b5f8ea0",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy import stats\na = [8.88, 9.12, 9.04, 8.98, 9.00, 9.08, 9.01, 8.85, 9.06, 8.99]\nb = [8.88, 8.95, 9.29, 9.44, 9.15, 9.58, 8.36, 9.18, 8.67, 9.05]\nc = [8.95, 9.12, 8.95, 8.85, 9.03, 8.84, 9.07, 8.98, 8.86, 8.98]\nstat, p = stats.levene(a, b, c)\np",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "0.002431505967249681"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "174d302d",
            "cell_type": "markdown",
            "source": "The small p-value suggests that the populations do not have equal\nvariances.\n\nThis is not surprising, given that the sample variance of `b` is much\nlarger than that of `a` and `c`:\n",
            "metadata": {}
        },
        {
            "id": "31cd1af1",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "[np.var(x, ddof=1) for x in [a, b, c]]",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "[0.007054444444444413, 0.13073888888888888, 0.008890000000000002]"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "3a4cdbcd",
            "cell_type": "markdown",
            "source": "For a more detailed example, see :ref:`hypothesis_levene`.",
            "metadata": {}
        }
    ]
}