{
  "aliases": null,
  "backlinks": [
    {
      "field": "uses",
      "target": "30XVCMK916"
    }
  ],
  "body": "\n## Statement\n\nLet $Z$ be a [[normal|05AQE0QR0D]] random variable with mean $\\mu \\in \\R$ and variance $\\sigma^2 \u003e 0$.\nLet $g \\colon \\R \\to \\R$ be [[absolutely continuous|ZT6F4C2YHK]] on every bounded interval, with derivative $g'$, and assume $E\\abs{g'(Z)} \u003c \\infty$.\nThen $E\\abs{g(Z)(Z - \\mu)} \u003c \\infty$ and\n$$E\\big[ g(Z) (Z - \\mu) \\big] = \\sigma^2 \\, E\\big[ g'(Z) \\big].$$\n\n## Remarks\n\nThe normal density $\\varphi$ with mean $\\mu$ and variance $\\sigma^2$ satisfies $\\varphi'(z) = -\\frac{z - \\mu}{\\sigma^2} \\varphi(z)$.\nSo the left side is $-\\sigma^2 \\int g(z) \\varphi'(z) \\, dz$, and [[integration by parts|08Y1BBQTK9]] moves the derivative onto $g$.\nThe integrability hypothesis is what controls the boundary terms at $\\pm\\infty$; the careful proof writes $g(z) - g(\\mu)$ as an integral of $g'$ and uses Fubini's theorem.\n\nExample: with $\\mu = 0$ and $g(z) = z^3$, the left side is $E[Z^4] = 3\\sigma^4$.\nThe right side is $\\sigma^2 E[3Z^2] = 3\\sigma^4$, as it should be.\n\nThe multivariate form is used in estimation.\nIf $X$ is [[multivariate normal|0XN3K7RSZY]] with mean $\\theta$ and covariance $\\sigma^2 I_p$, then $E[(X_i - \\theta_i) g(X)] = \\sigma^2 E[\\partial_i g(X)]$ for suitable $g \\colon \\R^p \\to \\R$.\n\n## Explanations\n\n### L1 human\n\nFor a bell-shaped random variable, the average of $g(Z)$ times the deviation of $Z$ from its mean equals the variance times the average slope of $g$.\nIt is an integration by parts in disguise.\nIt turns covariances with the data into averages of derivatives, which are often easier to handle.\n\n### L2 human\n\nThe identity characterizes the normal distribution: if it holds for all bounded smooth $g$, then $Z$ is normal with mean $\\mu$ and variance $\\sigma^2$.\nThis is the starting point of Stein's method for proving normal approximations.\nIn decision theory, the multivariate form gives Stein's unbiased risk estimate and through it the risk of the James–Stein estimator.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "about": [
      "05AQE0QR0D"
    ],
    "kind": "statement",
    "msc": [
      "62C15",
      "62E10",
      "60E05"
    ],
    "name": "Stein's lemma",
    "role": "lemma",
    "same_as": {
      "wikidata": "Q7606741",
      "wikipedia": "Stein's lemma"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Stein's_lemma"
      }
    ],
    "tag": "6PWC83R457",
    "uses": [
      "05AQE0QR0D",
      "0WQNRCNY3M",
      "ZT6F4C2YHK",
      "08Y1BBQTK9",
      "0XN3K7RSZY"
    ]
  },
  "kind": "statement",
  "link": "https://tamnd.github.io/math2/node/6PWC83R457/",
  "links": [
    {
      "field": "about",
      "target": "05AQE0QR0D"
    },
    {
      "field": "uses",
      "target": "05AQE0QR0D"
    },
    {
      "field": "uses",
      "target": "0WQNRCNY3M"
    },
    {
      "field": "uses",
      "target": "ZT6F4C2YHK"
    },
    {
      "field": "uses",
      "target": "08Y1BBQTK9"
    },
    {
      "field": "uses",
      "target": "0XN3K7RSZY"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/6PWC83R457.md",
  "msc": [
    "62C15",
    "62E10",
    "60E05"
  ],
  "name": "Stein's lemma",
  "prov": null,
  "role": "lemma",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/6PW/6PWC83R457.md",
  "status": null,
  "tag": "6PWC83R457",
  "uri": "m2://6PWC83R457",
  "url": "https://tamnd.github.io/math2/wiki/steins-lemma/",
  "writing": {
    "tag": "6PWC83R457",
    "kind": "statement",
    "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
      }
    ]
  }
}
