// y: probability of occurrence, given hypothesis is true
// z: probability of occurrence, given hypothesis is false
bayes=(x,y,z)=>(x*y)/((x*y)+z*(1-x))
// you come home to find another person's underwear on your bed. is your spouse cheating?
cheating=bayes(0.04,0.5,0.05)
// chance you have breast cancer if you get a positive mammogram in your 40s
mammogram40s=bayes(0.014,0.75,0.1)
// probability the first 9/11 plane was a terrorist attack
first911=bayes(0.00005,1,0.00008)
// probability the second 9/11 plane was a terrorist attack
second911=bayes(first911,1,0.00008)
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.