{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Suppose a continuous probability distribution has support "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "[l, r]"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The log-CCDF returns its minimum value of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(0)=-\\infty"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x ≥ r"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and its maximum value of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(1) = 0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x ≤ l"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". An analogous statement can be made for discrete distributions, but the inequality governing the maximum value is strict."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For distributions with infinite support, it is common for "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "ccdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.ccdf"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to return a value of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " when the argument is theoretically within the support; this can occur because the true value of the CCDF is too small to be represented by the chosen dtype. The log of the CCDF, however, will often be finite (not "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "-inf"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") over a much larger domain. Similarly, "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "logccdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logccdf"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " may provided a strictly negative result with arguments for which "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "ccdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.ccdf"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " would return "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "1.0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Consequently, it may be preferred to work with the logarithms of probabilities to avoid underflow and related limitations of floating point numbers."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The \"logarithmic complement\" of a number "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "z"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is mathematically equivalent to "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(1-\\exp(z))"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but it is computed to avoid loss of precision when "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\exp(z)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is nearly "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Similarly, the term \"logarithmic sum\" of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "w"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "z"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is used here to mean the "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(\\exp(w)+\\exp(z))"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", AKA "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\text{LogSumExp}(w, z)"
            },
            {
              "__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": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "out",
              "annotation": "array",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The log-CCDF evaluated at the provided argument(s)."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Log of the complementary cumulative distribution function"
            }
          ]
        }
      ],
      "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": "x, y",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The arguments of the log-CCDF. "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is required; "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is optional."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "method",
              "annotation": "{None, 'formula', 'logexp', 'complement', 'quadrature', 'addition'}",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The strategy used to evaluate the log-CCDF. By default ("
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "), the one-argument form of the function chooses between the following options, listed in order of precedence."
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "'formula'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": use a formula for the log CCDF itself"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "'logexp'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": evaluate the CCDF and take the logarithm"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "'complement'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": evaluate the log-CDF and take the   logarithmic complement (see Notes)"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "'quadrature'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": numerically log-integrate the log-PDF (or, in the   discrete case, log-sum the log-PMF)"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The two-argument form chooses between:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "'formula'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": use a formula for the log CCDF itself"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "'addition'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": compute the log-CDF at "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "x"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " and the log-CCDF at "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "y"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ",   then take the logarithmic sum (see Notes)"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Not all "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "method"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " options are available for all distributions. If the selected "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "method"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not available, a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "NotImplementedError"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will be raised."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The complementary cumulative distribution function (\"CCDF\"), denoted "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "G(x)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the complement of the cumulative distribution function "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "F(x)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "; i.e., probability the random variable "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will assume a value greater than "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ":"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "G(x) = 1 - F(x) = P(X > x)"
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "A two-argument variant of this function is:"
                }
              ]
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "G(x, y) = 1 - F(x, y) = P(X < x \\quad \\text{or} \\quad X > y)"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "logccdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logccdf"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " computes the logarithm of the complementary cumulative distribution function (\"log-CCDF\"), "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(G(x))"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "/"
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(G(x, y))"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but it may be numerically favorable compared to the naive implementation (computing the CDF and taking the logarithm)."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "logccdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logccdf"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " accepts "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "y"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "y"
            },
            {
              "__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/_probability_distribution.py",
  "item_line": 1625,
  "item_type": "function",
  "aliases": [
    "scipy.stats._distribution_infrastructure._ProbabilityDistribution.logccdf"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Instantiate a distribution with the desired parameters:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy import stats\nX = stats.Uniform(a=-0.5, b=0.5)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nEvaluate the log-CCDF at the desired argument:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "X.logccdf(0.25)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.allclose(X.logccdf(0.), np.log(X.ccdf(0.)))\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "ccdf",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.ccdf"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "logcdf",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logcdf"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "self",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "x",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "y",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "method",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "logccdf"
  },
  "references": [
    ".. [1] Cumulative distribution function, *Wikipedia*,",
    "       https://en.wikipedia.org/wiki/Cumulative_distribution_function#Derived_functions"
  ],
  "qa": "scipy.stats._probability_distribution:_ProbabilityDistribution.logccdf",
  "arbitrary": [],
  "local_refs": [
    "method",
    "out",
    "x",
    "y"
  ]
}