This webapp runs the following PyMC model in your browser:
import pymc as pm
with pm.Model() as model:
p = pm.Beta("p", alpha=1, beta=1)
obs = pm.Binomial("obs", p=p, n=n,
observed=k)
idata = pm.sample()
This is a simple beta-binomial or coin-flip model.
Enter how many coin-flips you did (n) and how many times it came up heads (k).
Then press "Sample!" to run the NUTS sampler.
For a full explanation, see this blog post.
from pyodide.ffi import create_proxy
@create_proxy
def on_click():
k = Element('input_box_k').element.value
if k == "":
k = 5
n = Element('input_box_n').element.value
if n == "":
n = 10
run_model(n=n, k=k)
Sampling will take a couple of seconds.
The resulting posterior belief into what
probabilities of obtaining heads are plausible will show up below: