Bayesian Posterior Update
Prior → likelihood → posterior over a parameter θ.
Rendering…
Make it your own.
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": { "values": [
{"theta":0.0,"prior":0.0,"like":0.0,"post":0.0},
{"theta":0.1,"prior":0.5,"like":0.05,"post":0.06},
{"theta":0.2,"prior":1.2,"like":0.18,"post":0.30},
{"theta":0.3,"prior":2.0,"like":0.48,"post":1.0},
{"theta":0.4,"prior":2.4,"like":0.95,"post":2.4},
{"theta":0.5,"prior":2.0,"like":1.20,"post":2.5},
{"theta":0.6,"prior":1.2,"like":0.95,"post":1.2},
{"theta":0.7,"prior":0.5,"like":0.48,"post":0.30},
{"theta":0.8,"prior":0.1,"like":0.18,"post":0.02},
{"theta":0.9,"prior":0.0,"like":0.05,"post":0.0}
]},
"transform":[
{"fold":["prior","like","post"], "as":["dist","p"]}
],
"mark":{"type":"line","interpolate":"monotone","strokeWidth":2.5},
"encoding":{
"x":{"field":"theta","type":"quantitative","title":"θ"},
"y":{"field":"p","type":"quantitative","title":"Density"},
"color":{"field":"dist","type":"nominal",
"scale":{"domain":["prior","like","post"],"range":["#94a3b8","#dc2626","#3666ff"]},
"legend":{"title":null}}
},
"width":480,"height":280
}