Search code examples
bayesianpymc3mcmc

Why does pymc3 run even when I don't include any observations?


Even when I don't include any observed values, pymc3 will still run and give me results. Is this just sampling from the prior without the likelihood?

''' import pymc3 as pm model = pm.Model()

with model:

# Define the prior of the parameter lambda.
lam = pm.Gamma('lambda', alpha=3.5, beta=2)

with model:
trace = pm.sample(draws=20, chains=3)

pm.traceplot(trace) '''


Solution

  • Yes, you're just sampling from the prior. If you want to, you can check that by plotting the samples as histogram or kernel density estimate and compare it to the pdf you get from scipy.stats.gamma.