{
  "__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-CDF evaluates to its minimum value of "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(0) = -\\infty"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x ≤ l"
            },
            {
              "__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 ≥ r"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". An analogous statement can be made for discrete distributions, but the inequality governing the minimum 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": "cdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.cdf"
              },
              "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 CDF is too small to be represented by the chosen dtype. "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "logcdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logcdf"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", however, will often return a finite (not "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "-inf"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") result over a much larger domain. Similarly, "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "logcdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logcdf"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " may provided a strictly negative result with arguments for which "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "cdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.cdf"
              },
              "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 difference\" 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 "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(\\exp(w)-\\exp(z))"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "y < x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the CDF is negative, and therefore the log-CCDF is complex with imaginary part "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\pi"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". For consistency, the result of this function always has complex dtype when "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "y"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is provided, regardless of the value of the imaginary part."
            }
          ]
        }
      ],
      "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-CDF 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 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-CDF. "
                    },
                    {
                      "__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', 'subtraction'}",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The strategy used to evaluate the log-CDF. 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-CDF itself"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "'logexp'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": evaluate the CDF 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-CCDF 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": "In place of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'complement'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the two-argument form accepts:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "'subtraction'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": compute the log-CDF at each argument and take   the logarithmic difference (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 cumulative distribution function (\"CDF\"), denoted "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "F(x)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", is the probability the random variable "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will assume a value less than or equal to "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ":"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "F(x) = P(X ≤ x)"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A two-argument variant of this function is also defined as the probability the random variable "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will assume a value between "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "y"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "F(x, y) = P(x ≤ X ≤ y)"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "logcdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logcdf"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " computes the logarithm of the cumulative distribution function (\"log-CDF\"), "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(F(x))"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "/"
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\log(F(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": "logcdf",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logcdf"
              },
              "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": 1427,
  "item_type": "function",
  "aliases": [
    "scipy.stats._distribution_infrastructure._ProbabilityDistribution.logcdf"
  ],
  "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-CDF at the desired argument:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "X.logcdf(0.25)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.allclose(X.logcdf(0.), np.log(X.cdf(0.)))\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "cdf",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.cdf"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "logccdf",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._probability_distribution:_ProbabilityDistribution.logccdf"
        },
        "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": "logcdf"
  },
  "references": [
    ".. [1] Cumulative distribution function, *Wikipedia*,",
    "       https://en.wikipedia.org/wiki/Cumulative_distribution_function"
  ],
  "qa": "scipy.stats._probability_distribution:_ProbabilityDistribution.logcdf",
  "arbitrary": [],
  "local_refs": [
    "method",
    "out",
    "x",
    "y"
  ]
}