{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $S$ be a countable set, let $\\pi$ be a probability distribution on $S$, and let $f \\colon S \\to \\R$ be bounded.\nA *Markov chain Monte Carlo method* for estimating $\\pi(f) = \\sum_{x \\in S} f(x) \\pi(x)$ consists of:\n\n1. a [[transition matrix|0F462493EA]] $P$ on $S$ such that $\\pi$ is a [[stationary distribution|0KRH5157WP]] of $P$ and the chain with transition matrix $P$ is irreducible;\n2. a [[Markov chain|033TJBZDG0]] $(X_k)_{k \\ge 0}$ with transition matrix $P$, simulated from some starting state;\n3. the estimator $\\hat{\\pi}_n(f) = \\frac{1}{n} \\sum_{k=1}^{n} f(X_k)$, computed for a large $n$.\n\n## Remarks\n\nBy the ergodic theorem for irreducible chains with a stationary distribution, $\\hat{\\pi}_n(f) \\to \\pi(f)$ almost surely as $n \\to \\infty$, for every starting state.\nThe usual way to obtain clause 1 is to impose [[detailed balance|CTGN6CK1ZS]] for $\\pi$, as the [[Metropolis–Hastings algorithm|MKHF449E22]] does.\nIn practice the first steps, the burn-in, are often discarded, and if the chain is also aperiodic then the law of $X_k$ tends to $\\pi$ by the [[convergence theorem|B1E1ES1BYD]].\nExample: on $S = \\Z$ with $\\pi(x) \\propto e^{-x^2}$, propose $x \\pm 1$ with probability $1/2$ each and accept with probability $\\min(1, \\pi(y)/\\pi(x))$.\nThis chain is irreducible and satisfies detailed balance for $\\pi$.\nNon-example: the simple [[random walk|04VZE3FZXF]] on the path $\\set{1, \\ldots, m}$, which moves to a uniform neighbour, has stationary law proportional to the degrees.\nSo its averages estimate expectations under that law, not under the uniform law, and it fails clause 1 for uniform $\\pi$ when $m \\ge 3$.\n",
  "commit": "efe85cee8dbc57d85bedbacfb97b99d1b7bee843",
  "front": {
    "defines": "ZGNBR2SPZ0",
    "kind": "definition",
    "msc": [
      "65C05",
      "60J22",
      "65C40"
    ],
    "name": "Markov chain Monte Carlo",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo"
      }
    ],
    "tag": "MECCMT61DV",
    "uses": [
      "033TJBZDG0",
      "0F462493EA",
      "0KRH5157WP",
      "CTGN6CK1ZS",
      "MKHF449E22",
      "B1E1ES1BYD",
      "04VZE3FZXF"
    ]
  },
  "kind": "definition",
  "link": "https://math2.tamnd.com/node/MECCMT61DV/",
  "links": [
    {
      "field": "defines",
      "target": "ZGNBR2SPZ0"
    },
    {
      "field": "uses",
      "target": "033TJBZDG0"
    },
    {
      "field": "uses",
      "target": "0F462493EA"
    },
    {
      "field": "uses",
      "target": "0KRH5157WP"
    },
    {
      "field": "uses",
      "target": "CTGN6CK1ZS"
    },
    {
      "field": "uses",
      "target": "MKHF449E22"
    },
    {
      "field": "uses",
      "target": "B1E1ES1BYD"
    },
    {
      "field": "uses",
      "target": "04VZE3FZXF"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/MECCMT61DV.md",
  "msc": [
    "65C05",
    "60J22",
    "65C40"
  ],
  "name": "Markov chain Monte Carlo",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/MEC/MECCMT61DV.md",
  "status": null,
  "tag": "MECCMT61DV",
  "uri": "m2://MECCMT61DV",
  "url": "https://math2.tamnd.com/wiki/markov-chain-monte-carlo-definition/",
  "writing": {
    "tag": "MECCMT61DV",
    "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
      }
    ]
  }
}
