{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This distribution is the normal distribution centered on "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "loc"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (default 0), with standard deviation "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "scale"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (default 1), and truncated at "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "a"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "standard deviations"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "loc"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". For arbitrary "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "loc"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "scale"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "a"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "not"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " the abscissae at which the shifted and scaled distribution is truncated."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "If "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "a_trunc"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " and "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "b_trunc"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " are the abscissae at which we wish to truncate the distribution (as opposed to the number of standard deviations from "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "loc"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "), then we can calculate the distribution parameters "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "a"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " and "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "b"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " as follows      "
                }
              ]
            },
            {
              "__type": "Code",
              "__tag": 4050,
              "value": "a, b = (a_trunc - loc) / scale, (b_trunc - loc) / scale",
              "execution_status": null
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "This is a common point of confusion. For additional clarification, please see the example below."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "%(example)s"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the examples above, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "loc=0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "scale=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", so the plot is truncated at "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "a"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " on the left and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " on the right. However, suppose we were to produce the same histogram with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "loc = 1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "scale=0.5"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ">>> loc, scale = 1, 0.5\n>>> rv = truncnorm(a, b, loc=loc, scale=scale)\n>>> x = np.linspace(truncnorm.ppf(0.01, a, b),\n...                 truncnorm.ppf(0.99, a, b), 100)\n>>> r = rv.rvs(size=1000)",
          "execution_status": null
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ">>> fig, ax = plt.subplots(1, 1)\n>>> ax.plot(x, rv.pdf(x), 'k-', lw=2, label='frozen pdf')\n>>> ax.hist(r, density=True, bins='auto', histtype='stepfilled', alpha=0.2)\n>>> ax.set_xlim(a, b)\n>>> ax.legend(loc='best', frameon=False)\n>>> plt.show()",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that the distribution is no longer appears to be truncated at abscissae "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "a"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". That is because the "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "standard"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " normal distribution is first truncated at "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "a"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "then"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " the resulting distribution is scaled by "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "scale"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and shifted by "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "loc"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". If we instead want the shifted and scaled distribution to be truncated at "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "a"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", we need to transform these values before passing them as the distribution parameters."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ">>> a_transformed, b_transformed = (a - loc) / scale, (b - loc) / scale\n>>> rv = truncnorm(a_transformed, b_transformed, loc=loc, scale=scale)\n>>> x = np.linspace(truncnorm.ppf(0.01, a, b),\n...                 truncnorm.ppf(0.99, a, b), 100)\n>>> r = rv.rvs(size=10000)",
          "execution_status": null
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ">>> fig, ax = plt.subplots(1, 1)\n>>> ax.plot(x, rv.pdf(x), 'k-', lw=2, label='frozen pdf')\n>>> ax.hist(r, density=True, bins='auto', histtype='stepfilled', alpha=0.2)\n>>> ax.set_xlim(a-0.1, b+0.1)\n>>> ax.legend(loc='best', frameon=False)\n>>> plt.show()",
          "execution_status": null
        }
      ],
      "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": "A truncated normal continuous random variable."
            }
          ]
        }
      ],
      "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": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "%(before_notes)s"
            }
          ]
        }
      ],
      "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/_continuous_distns.py",
  "item_line": 10217,
  "item_type": "class",
  "aliases": [
    "scipy.stats._continuous_distns.truncnorm_gen"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "momtype",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "a",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "b",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "xtol",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1e-14"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "badvalue",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "name",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "longname",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "shapes",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "seed",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "truncnorm_gen"
  },
  "references": null,
  "qa": "scipy.stats._continuous_distns:truncnorm_gen",
  "arbitrary": [],
  "local_refs": []
}