{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "16eec14b",
            "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": "8228931f",
            "cell_type": "markdown",
            "source": "First we generate some random data from a Weibull distribution\nwith shape parameter 2.5, and plot the histogram of the data:\n",
            "metadata": {}
        },
        {
            "id": "46c6233e",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy import stats\nimport matplotlib.pyplot as plt\nrng = np.random.default_rng()\nc = 2.5\nx = stats.weibull_min.rvs(c, scale=4, size=2000, random_state=rng)",
            "outputs": []
        },
        {
            "id": "17df28bc",
            "cell_type": "markdown",
            "source": "Take a look at the histogram of the data.\n",
            "metadata": {}
        },
        {
            "id": "faec8f57",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "fig1, ax = plt.subplots(figsize=(9, 4))\nax.hist(x, bins=50)\nax.set_title('Histogram of x')\nplt.show()",
            "outputs": []
        },
        {
            "id": "acd9b2d8",
            "cell_type": "markdown",
            "source": "Now we explore this data with a PPCC plot as well as the related\nprobability plot and Box-Cox normplot.  A red line is drawn where we\nexpect the PPCC value to be maximal (at the shape parameter ``c``\nused above):\n",
            "metadata": {}
        },
        {
            "id": "cb4efa00",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "fig2 = plt.figure(figsize=(12, 4))\nax1 = fig2.add_subplot(1, 3, 1)\nax2 = fig2.add_subplot(1, 3, 2)\nax3 = fig2.add_subplot(1, 3, 3)\nres = stats.probplot(x, plot=ax1)\nres = stats.boxcox_normplot(x, -4, 4, plot=ax2)\nres = stats.ppcc_plot(x, c/2, 2*c, dist='weibull_min', plot=ax3)\nax3.axvline(c, color='r')\nplt.show()",
            "outputs": []
        }
    ]
}