Skip to content
Glacius
StatisticsConcept reference

Grid posteriors

On a finite grid with positive evidence, posterior mass is likelihood times prior mass divided by the sum of all such weights.

On this page 9 sections
  1. Overview
  2. A posterior grid keeps uncertainty over an explicitly finite set of parameter candidates
  3. For prior (0.6,0.4) and likelihood (0.5,0.25), weights are (0.3,0.1)
  4. Match candidate labels before multiplying
  5. Keep candidate labels attached to their masses when lists are reordered
  6. Key takeaway
  7. Further questions
  8. Sources & further reading
  9. Concept connections

01A posterior grid keeps uncertainty over an explicitly finite set of parameter candidates#

A posterior grid keeps uncertainty over an explicitly finite set of parameter candidates. Each candidate receives a weight from prior mass times likelihood. Normalizing these weights gives a probability distribution you can use for more than selecting a single winner.

Weights (0.1,0.3,0.1)(0.1,0.3,0.1) total 0.5. Dividing every weight by that same total gives (0.2,0.6,0.2)(0.2,0.6,0.2). The posterior keeps all three candidates.

The finite candidate grid A,B,C has positive weights .1,.3,.1, with total .5. Dividing by .5 gives posterior masses .2,.6,.2. Three bars have heights proportional to those masses, using 160 pixels per probability unit; all masses and candidate labels remain explicit.The finite candidate grid A,B,C has positive weights .1,.3,.1, with total .5. Dividing by .5 gives posterior masses .2,.6,.2. Three bars have heights proportional to those masses, using 160 pixels per probability unit; all masses and candidate labels remain explicit.
Figure 1The finite candidate grid A,B,C has positive weights .1,.3,.1, with total .5. Dividing by .5 gives posterior masses .2,.6,.2. Three bars have heights proportional to those masses, using 160 pixels per probability unit; all masses and candidate labels remain explicit.
Link to this figure ↗Download SVGDownload PNG

For an explicitly finite grid, multiply each prior mass by its data likelihood. The total of all weights must be positive before normalizing.

wj=LjπjP(θjx)=wjkwk\begin{gathered}w_j=L_j\pi_j\\P(\theta_j\mid x)=\frac{w_j}{\sum_k w_k}\end{gathered}

For prior (0.6,0.4)(0.6,0.4) and likelihood (0.5,0.25)(0.5,0.25), weights are (0.3,0.1)(0.3,0.1). Their sum 0.4 is the normalization constant. Divide both weights by 0.4 to obtain (0.75,0.25)(0.75,0.25), which sums to 1. Dividing each candidate by a different total would not produce this posterior.

Check your reasoning

Finite grid (A,B,C). Prior (0.2,0.4,0.4)(0.2,0.4,0.4); likelihood (0.5,0.5,0.25)(0.5,0.5,0.25). Give posterior masses in that order.

  1. A(0.1,0.2,0.1)
  2. B(0.25,0.5,0.25)
  3. C(0.4,0.4,0.2)
Show answer and explanation
(0.25,0.5,0.25)

Divide by total 0.40.4.

02For prior (0.6,0.4) and likelihood (0.5,0.25), weights are (0.3,0.1)#

For prior (0.6,0.4)(0.6,0.4) and likelihood (0.5,0.25)(0.5,0.25), weights are (0.3,0.1)(0.3,0.1). Their total 0.4 gives posterior (0.75,0.25)(0.75,0.25). Raw weights are not yet a probability distribution.

Check your reasoning

Finite grid (A,B,C). Prior (0.4,0.4,0.2)(0.4,0.4,0.2); likelihood (0.2,0.3,0.4)(0.2,0.3,0.4). Claim: posterior (0.08,0.12,0.08)(0.08,0.12,0.08). Repair.

  1. A(2/7,3/7,2/7)
  2. B(0.08,0.12,0.08)
  3. C(0.4,0.4,0.2)
Show answer and explanation
(2/7,3/7,2/7)

Divide by total 0.280.28.

03Match candidate labels before multiplying#

Match candidate labels before multiplying. Reordering the supplied prior does not change which candidate owns each mass. Zero-weight candidates keep mass 0; divide every other weight by the same positive total.

Check your reasoning

Prior for (C,B,A) is (0.2,0.5,0.3)(0.2,0.5,0.3). Data likelihood for (A,B,C) is (0.2,0.4,0.5)(0.2,0.4,0.5). Return posterior (A,B,C).

  1. A(5/18,5/9,1/6)
  2. B(2/11,4/11,5/11)
  3. C(1/6,5/9,5/18)
Show answer and explanation
(1/6,5/9,5/18)

Divide by total 0.360.36.

04Keep candidate labels attached to their masses when lists are reordered#

Keep candidate labels attached to their masses when lists are reordered. This posterior expresses uncertainty within the finite model; omitted parameter values receive no probability. Approximating a continuous model with a grid requires additional care in assigning prior mass.

Key takeaway

Multiply matching likelihoods and priors, then divide every weight by their positive total. Keep the complete ordered distribution.

  • Normalize posterior weights over a finite parameter grid.

Further questions

What if every candidate has zero weight?
The evidence is zero under the supplied finite model. This update cannot be normalized; the stated model and observation require reconsideration.

Sources & further reading

  1. [1]
  2. [2]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Grid posteriors.” Math behind ML. /learn/s-posterior-grid