{
  "__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": "build-install/usr/lib/python3.14/site-packages/scipy/stats/_distribution_infrastructure.py",
  "item_line": 4879,
  "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.00288, 0.0036 , 0.02157, 0.02948, 0.04818, 0.06688, 0.13807,\n       0.20567, 0.31067, 0.4322 , 0.52497, 0.65082, 0.68246, 0.69757,\n       0.67815, 0.64003, 0.57747, 0.45665, 0.33224, 0.2481 , 0.18194,\n       0.10284, 0.07623, 0.03668, 0.02589, 0.00863, 0.00431, 0.00288,\n       0.00072, 0.0036 ]), array([-1.41688, -1.27783, -1.13877, -0.99972, -0.86066, -0.72161,\n       -0.58255, -0.4435 , -0.30444, -0.16539, -0.02633,  0.11272,\n        0.25178,  0.39084,  0.52989,  0.66895,  0.808  ,  0.94706,\n        1.08611,  1.22517,  1.36422,  1.50328,  1.64233,  1.78139,\n        1.92044,  2.0595 ,  2.19855,  2.33761,  2.47666,  2.61572,\n        2.75477]), <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": "2.0.0.dev0+git20260907.41eeb59",
          "kind": "assets",
          "path": "fig-f820471c7c7a76a2.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"
  ]
}