{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The conditional odds ratio was discussed by Fisher (see \"Example 1\" of "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ").  Texts that cover the odds ratio include "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "3"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 1.10.0"
                }
              ]
            }
          ]
        }
      ],
      "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": "result",
              "annotation": "`~scipy.stats._result_classes.OddsRatioResult` instance",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The returned object has two computed attributes:"
                    }
                  ]
                },
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "statistic"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "statistic"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The object has the method "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "confidence_interval",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " that computes the confidence interval of the odds ratio."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the odds ratio for a 2x2 contingency table."
            }
          ]
        }
      ],
      "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": "table",
              "annotation": "array_like of ints",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A 2x2 contingency table.  Elements must be non-negative integers."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "kind",
              "annotation": "str, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Which kind of odds ratio to compute, either the sample odds ratio ("
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "kind='sample'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") or the conditional odds ratio ("
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "kind='conditional'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ").  Default is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'conditional'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "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/_odds_ratio.py",
  "item_line": 324,
  "item_type": "function",
  "aliases": [
    "scipy.stats._odds_ratio.odds_ratio"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "In epidemiology, individuals are classified as \"exposed\" or\n\"unexposed\" to some factor or treatment. If the occurrence of some\nillness is under study, those who have the illness are often\nclassified as \"cases\", and those without it are \"noncases\".  The\ncounts of the occurrences of these classes gives a contingency\ntable::\n\n                exposed    unexposed\n    cases          a           b\n    noncases       c           d\n\nThe sample odds ratio may be written ``(a/c) / (b/d)``.  ``a/c`` can\nbe interpreted as the odds of a case occurring in the exposed group,\nand ``b/d`` as the odds of a case occurring in the unexposed group.\nThe sample odds ratio is the ratio of these odds.  If the odds ratio\nis greater than 1, it suggests that there is a positive association\nbetween being exposed and being a case.\n\nInterchanging the rows or columns of the contingency table inverts\nthe odds ratio, so it is important to understand the meaning of labels\ngiven to the rows and columns of the table when interpreting the\nodds ratio.\n\nConsider a hypothetical example where it is hypothesized that exposure to a\ncertain chemical is associated with increased occurrence of a certain\ndisease. Suppose we have the following table for a collection of 410 people::\n\n            exposed unexposed\n    cases        7       15\n    noncases    58      472\n\nThe question we ask is \"Is exposure to the chemical associated with\nincreased risk of the disease?\"\n\nCompute the odds ratio:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.stats.contingency import odds_ratio\nres = odds_ratio([[7, 15], [58, 472]])\nres.statistic\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nFor this sample, the odds of getting the disease for those who have been\nexposed to the chemical are almost 3.8 times that of those who have not been\nexposed.\n\nWe can compute the 95% confidence interval for the odds ratio:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.confidence_interval(confidence_level=0.95)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe 95% confidence interval for the conditional odds ratio is approximately\n(1.25, 10.4).\n\nFor a more detailed example, see :ref:`hypothesis_odds_ratio`."
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "hypothesis_odds_ratio",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "hypothesis_odds_ratio"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Extended example"
            }
          ]
        }
      ],
      "type": "ref"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "relative_risk",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._relative_risk:relative_risk"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "scipy.stats.fisher_exact",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._stats_py:fisher_exact"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "table",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "kind",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "conditional"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "odds_ratio"
  },
  "references": [
    ".. [1] R. A. Fisher (1935), The logic of inductive inference,",
    "       Journal of the Royal Statistical Society, Vol. 98, No. 1,",
    "       pp. 39-82.",
    ".. [2] Breslow NE, Day NE (1980). Statistical methods in cancer research.",
    "       Volume I - The analysis of case-control studies. IARC Sci Publ.",
    "       (32):5-338. PMID: 7216345. (See section 4.2.)",
    ".. [3] H. Sahai and A. Khurshid (1996), Statistics in Epidemiology:",
    "       Methods, Techniques, and Applications, CRC Press LLC, Boca",
    "       Raton, Florida."
  ],
  "qa": "scipy.stats._odds_ratio:odds_ratio",
  "arbitrary": [],
  "local_refs": [
    "kind",
    "result",
    "table"
  ]
}