{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "4914ab1b",
            "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": "8c5d0152",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy import stats\nimport matplotlib.pyplot as plt",
            "outputs": []
        },
        {
            "id": "53f31af5",
            "cell_type": "markdown",
            "source": "We generate some random variates from a non-normal distribution and make a\nprobability plot for it, to show it is non-normal in the tails:\n",
            "metadata": {}
        },
        {
            "id": "c3ef0ee0",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "fig = plt.figure()\nax1 = fig.add_subplot(211)\nx = stats.loggamma.rvs(5, size=500) + 5\nprob = stats.probplot(x, dist=stats.norm, plot=ax1)\nax1.set_xlabel('')\nax1.set_title('Probplot against normal distribution')",
            "outputs": []
        },
        {
            "id": "76b5c697",
            "cell_type": "markdown",
            "source": "We now use `yeojohnson` to transform the data so it's closest to normal:\n",
            "metadata": {}
        },
        {
            "id": "cddbc09c",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "ax2 = fig.add_subplot(212)\nxt, lmbda = stats.yeojohnson(x)\nprob = stats.probplot(xt, dist=stats.norm, plot=ax2)\nax2.set_title('Probplot after Yeo-Johnson transformation')",
            "outputs": []
        },
        {
            "id": "007d3fb6",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "plt.show()",
            "outputs": []
        }
    ]
}