{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $x_1, \\dots, x_n \\in \\R^p$ be known regressor vectors.\nA *generalized linear model* for independent responses $y_1, \\dots, y_n$ consists of three parts.\n\n1. Random component: each $y_i$ has the density $f(y; \\theta_i, \\phi) = \\exp\\big( (y \\theta_i - b(\\theta_i))/a(\\phi) + c(y, \\phi) \\big)$ with respect to a fixed measure.\nThis is an [[exponential family|EP9VPZ0S6G]] with natural parameter $\\theta_i$, dispersion parameter $\\phi \u003e 0$, and fixed functions $a, b, c$.\n2. Linear predictor: $\\eta_i = x_i^T \\beta$ for an unknown $\\beta \\in \\R^p$.\n3. Link: a known strictly monotone differentiable function $g$ such that $g(\\mu_i) = \\eta_i$, where $\\mu_i = E[y_i]$ is the [[expected value|0WQNRCNY3M]] of $y_i$.\n\n## Remarks\n\nIn the random component, $\\mu_i = b'(\\theta_i)$ and $\\operatorname{Var}(y_i) = a(\\phi) \\, b''(\\theta_i)$.\nThe link $g$ with $g(b'(\\theta)) = \\theta$ is the *canonical link*; with it, $\\theta_i = x_i^T \\beta$.\n\nExample: the normal distribution $N(\\mu, \\sigma^2)$ has the form of clause 1 with $\\theta = \\mu$, $b(\\theta) = \\theta^2/2$ and $a(\\phi) = \\phi = \\sigma^2$.\nWith the identity link, $\\mu_i = x_i^T \\beta$, and the model is normal [[linear regression|41FVC4P5JB]].\nExample: for Bernoulli responses with the logit link $g(\\mu) = \\log(\\mu/(1 - \\mu))$ one gets logistic regression; for Poisson responses with the log link one gets Poisson regression.\n\nNon-example: the model $y_i = x_i^T \\beta + \\varepsilon_i$ with independent standard Cauchy errors $\\varepsilon_i$ is not a generalized linear model.\nThe Cauchy location family is not of the form of clause 1, and $y_i$ has no expected value, so clause 3 cannot hold either.\n\nThe coefficients are estimated by [[maximum likelihood|0FREPFKNS7]]; with the canonical link the likelihood equations are $\\sum_i (y_i - \\mu_i) x_i = 0$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "K6C48KMRKC",
    "kind": "definition",
    "msc": [
      "62J12"
    ],
    "name": "Generalized linear model",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Generalized_linear_model"
      }
    ],
    "tag": "THH4GJFYQN",
    "uses": [
      "EP9VPZ0S6G",
      "41FVC4P5JB",
      "0WQNRCNY3M",
      "0FREPFKNS7"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/THH4GJFYQN/",
  "links": [
    {
      "field": "defines",
      "target": "K6C48KMRKC"
    },
    {
      "field": "uses",
      "target": "EP9VPZ0S6G"
    },
    {
      "field": "uses",
      "target": "41FVC4P5JB"
    },
    {
      "field": "uses",
      "target": "0WQNRCNY3M"
    },
    {
      "field": "uses",
      "target": "0FREPFKNS7"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/THH4GJFYQN.md",
  "msc": [
    "62J12"
  ],
  "name": "Generalized linear model",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/THH/THH4GJFYQN.md",
  "status": null,
  "tag": "THH4GJFYQN",
  "uri": "m2://THH4GJFYQN",
  "url": "https://tamnd.github.io/math2/wiki/generalized-linear-model-definition/",
  "writing": {
    "tag": "THH4GJFYQN",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
