{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The R package epitools has the function "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "riskratio",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", which accepts a table with the following layout                      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "                disease=0   disease=1\nexposed=0 (ref)    n00         n01\nexposed=1          n10         n11",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "With a 2x2 table in the above format, the estimate of the CI is computed by "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "riskratio",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " when the argument method=\"wald\" is given, or with the function "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "riskratio.wald",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For example, in a test of the incidence of lung cancer among a sample of smokers and nonsmokers, the \"exposed\" category would correspond to \"is a smoker\" and the \"disease\" category would correspond to \"has or had lung cancer\"."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To pass the same data to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "relative_risk"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", use      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "relative_risk(n11, n10 + n11, n01, n00 + n01)",
          "execution_status": null
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 1.7.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": "instance of `~scipy.stats._result_classes.RelativeRiskResult`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The object has the float attribute "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "relative_risk"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", which is      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "rr = (exposed_cases/exposed_total) / (control_cases/control_total)",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The object also has the method "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "confidence_interval"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to compute the confidence interval of the relative risk for a given confidence level."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the relative risk (also known as the risk ratio)."
            }
          ]
        }
      ],
      "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": "exposed_cases",
              "annotation": "nonnegative int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The number of \"cases\" (i.e. occurrence of disease or other event of interest) among the sample of \"exposed\" individuals."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "exposed_total",
              "annotation": "positive int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The total number of \"exposed\" individuals in the sample."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "control_cases",
              "annotation": "nonnegative int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The number of \"cases\" among the sample of \"control\" or non-exposed individuals."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "control_total",
              "annotation": "positive int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The total number of \"control\" individuals in the sample."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function computes the relative risk associated with a 2x2 contingency table ("
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", section 2.2.3; "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", section 3.1.2). Instead of accepting a table as an argument, the individual numbers that are used to compute the relative risk are given as separate parameters. This is to avoid the ambiguity of which row or column of the contingency table corresponds to the \"exposed\" cases and which corresponds to the \"control\" cases.  Unlike, say, the odds ratio, the relative risk is not invariant under an interchange of the rows or columns."
            }
          ]
        }
      ],
      "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/_relative_risk.py",
  "item_line": 125,
  "item_type": "function",
  "aliases": [
    "scipy.stats._relative_risk.relative_risk"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.stats.contingency import relative_risk\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThis example is from Example 3.1 of [2]_.  The results of a heart\ndisease study are summarized in the following table::\n\n             High CAT   Low CAT    Total\n             --------   -------    -----\n    CHD         27         44        71\n    No CHD      95        443       538\n\n    Total      122        487       609\n\nCHD is coronary heart disease, and CAT refers to the level of\ncirculating catecholamine.  CAT is the \"exposure\" variable, and\nhigh CAT is the \"exposed\" category. So the data from the table\nto be passed to ``relative_risk`` is::\n\n    exposed_cases = 27\n    exposed_total = 122\n    control_cases = 44\n    control_total = 487\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result = relative_risk(27, 122, 44, 487)\nresult.relative_risk\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nFind the confidence interval for the relative risk.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.confidence_interval(confidence_level=0.95)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe interval does not contain 1, so the data supports the statement\nthat high CAT is associated with greater risk of CHD."
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "odds_ratio",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._odds_ratio:odds_ratio"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "exposed_cases",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "exposed_total",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "control_cases",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "control_total",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "relative_risk"
  },
  "references": [
    ".. [1] Alan Agresti, An Introduction to Categorical Data Analysis",
    "       (second edition), Wiley, Hoboken, NJ, USA (2007).",
    ".. [2] Hardeo Sahai and Anwer Khurshid, Statistics in Epidemiology,",
    "       CRC Press LLC, Boca Raton, FL, USA (1996)."
  ],
  "qa": "scipy.stats._relative_risk:relative_risk",
  "arbitrary": [],
  "local_refs": [
    "control_cases",
    "control_total",
    "exposed_cases",
    "exposed_total",
    "result"
  ]
}