{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If we make "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " observations of a continuous random variable "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and sort them in increasing order "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X_{(1)}, \\dots, X_{(r)}, \\dots, X_{(n)}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", then "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X_{(r)}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is known as the "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "r^{\\text{th}}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " order statistic."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If the PDF, CDF, and CCDF of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are denoted by "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "f"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "F"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "G = 1 - F"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", respectively, then the PDF of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X_{(r)}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is given by:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "f_r(x) = \\frac{n!}{(r-1)! (n-r)!} f(x) F(x)^{r-1} G(x)^{n - r}"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The CDF and other methods of the distribution of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X_{(r)}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are calculated using the fact that "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X = F^{-1}(U)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", where "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "U"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a standard uniform random variable, together with the fact that the order statistics of i.i.d. uniform random variables follow a beta distribution "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "B(r, n - r + 1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Probability distribution of an order statistic."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "dist",
              "annotation": "`ContinuousDistribution`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The random variable "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "X"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "n",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The (positive integer) sample size "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "r",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The (positive integer) rank of the order statistic "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "r"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", satisfying "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "1 \\leq r \\leq n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "An instance of this class represents a random variable that follows the distribution of the "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "r^{\\text{th}}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " order statistic of a sample of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " observations of a random variable "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/stats/_distribution_infrastructure.py",
  "item_line": 4812,
  "item_type": "ABCMeta",
  "aliases": [
    "scipy.stats._distribution_infrastructure.OrderStatisticDistribution"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Suppose we are interested in order statistics of samples of size five drawn\nfrom the standard normal distribution. Plot the PDF of the fourth\norder statistic and compare with a normalized histogram from simulation.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy import stats\nfrom scipy.stats._distribution_infrastructure import OrderStatisticDistribution\nX = stats.Normal()\ndata = X.sample(shape=(10000, 5))\nsorted_data = np.sort(data, axis=1)\nY = OrderStatisticDistribution(X, r=4, n=5)\nax = plt.gca()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "Y.plot(ax=ax)\nax.hist(sorted_data[:, 3], density=True, bins=30)\n",
        "execution_status": "failure",
        "out": "(array([0.00215, 0.00358, 0.00788, 0.02435, 0.03223, 0.07306, 0.12248,\n       0.17333, 0.27217, 0.38677, 0.48059, 0.55938, 0.69332, 0.72626,\n       0.69045, 0.67684, 0.59161, 0.50495, 0.35525, 0.28291, 0.19195,\n       0.11961, 0.08308, 0.04584, 0.0308 , 0.01791, 0.01003, 0.00215,\n       0.     , 0.00143]), array([-1.47076, -1.33114, -1.19152, -1.0519 , -0.91228, -0.77267,\n       -0.63305, -0.49343, -0.35381, -0.21419, -0.07457,  0.06505,\n        0.20466,  0.34428,  0.4839 ,  0.62352,  0.76314,  0.90276,\n        1.04238,  1.18199,  1.32161,  1.46123,  1.60085,  1.74047,\n        1.88009,  2.01971,  2.15932,  2.29894,  2.43856,  2.57818,\n        2.7178 ]), <BarContainer object of 30 artists>)\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.18.0",
          "kind": "assets",
          "path": "fig-a6d583bb51afb420.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "dist",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "args",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "VAR_POSITIONAL",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "r",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "n",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "kwargs",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "VAR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "OrderStatisticDistribution"
  },
  "references": [
    ".. [1] Order statistic. *Wikipedia*. https://en.wikipedia.org/wiki/Order_statistic"
  ],
  "qa": "scipy.stats._distribution_infrastructure:OrderStatisticDistribution",
  "arbitrary": [],
  "local_refs": [
    "dist",
    "n",
    "r"
  ]
}