{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nConsider a state-space model: a [[Markov chain|0G48PYM96Q]] $(X_t)_{t \\ge 0}$ with initial density $\\mu$ and transition density $f(x_t \\mid x_{t-1})$.\nThe observations $Y_t$ are conditionally independent given the states, with density $g(y_t \\mid x_t)$.\nFix a number $N \\ge 1$ of particles and observed values $y_1, y_2, \\dots$.\nThe *bootstrap particle filter* (sequential importance resampling) runs as follows.\n\n1. Draw $x_0^{(1)}, \\dots, x_0^{(N)}$ independently from $\\mu$.\n2. At time $t \\ge 1$, draw $\\tilde x_t^{(i)}$ from $f(\\cdot \\mid x_{t-1}^{(i)})$ for each $i$.\n3. Compute the weights $w_t^{(i)} = g(y_t \\mid \\tilde x_t^{(i)}) / \\sum_{k=1}^{N} g(y_t \\mid \\tilde x_t^{(k)})$.\n4. Draw $x_t^{(1)}, \\dots, x_t^{(N)}$ from the weighted points, choosing $\\tilde x_t^{(i)}$ with probability $w_t^{(i)}$.\n\nThe filtering distribution of $X_t$ given $y_1, \\dots, y_t$ is approximated by the weighted empirical measure $\\sum_{i=1}^{N} w_t^{(i)} \\delta_{\\tilde x_t^{(i)}}$.\n\n## Remarks\n\nSteps 2 and 3 are a Monte Carlo version of the prediction step and of the update by [[Bayes' theorem|0NM6E9VW04]] in the exact filtering recursion.\nGeneral particle filters draw $\\tilde x_t^{(i)}$ from another proposal density $q$ and multiply the weight by $f / q$.\nAs $N \\to \\infty$, integrals against the particle approximation converge to the exact filtering integrals under mild conditions.\n\nExample: let $X_t = X_{t-1} + U_t$ and $Y_t = X_t + V_t$ with independent standard normal $U_t, V_t$.\nThen $g(y \\mid x)$ is proportional to $e^{-(y - x)^2 / 2}$, so particles close to $y_t$ get the largest weights in step 3.\nFor this linear Gaussian model the exact filter is the Kalman filter, and the particle filter approximates it.\n\nNon-example: if step 4 is left out, the method is sequential importance sampling.\nThen after a few steps almost all the weight sits on one particle, which is why the resampling step is part of the definition.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "BZK7HQDMT0",
    "kind": "definition",
    "msc": [
      "62M20",
      "65C35",
      "60G35"
    ],
    "name": "Particle filter",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Particle_filter"
      }
    ],
    "tag": "W8R4A5D4N8",
    "uses": [
      "HJVM390354",
      "0NM6E9VW04",
      "0990W5PN13",
      "0G48PYM96Q"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/W8R4A5D4N8/",
  "links": [
    {
      "field": "defines",
      "target": "BZK7HQDMT0"
    },
    {
      "field": "uses",
      "target": "HJVM390354"
    },
    {
      "field": "uses",
      "target": "0NM6E9VW04"
    },
    {
      "field": "uses",
      "target": "0990W5PN13"
    },
    {
      "field": "uses",
      "target": "0G48PYM96Q"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/W8R4A5D4N8.md",
  "msc": [
    "62M20",
    "65C35",
    "60G35"
  ],
  "name": "Particle filter",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/W8R/W8R4A5D4N8.md",
  "status": null,
  "tag": "W8R4A5D4N8",
  "uri": "m2://W8R4A5D4N8",
  "url": "https://tamnd.github.io/math2/wiki/particle-filter-definition/",
  "writing": {
    "tag": "W8R4A5D4N8",
    "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
      }
    ]
  }
}
