I am modeling data that I think is gamma distributed so I write a PyMC3 model as below.
import pymc3 as pm
import arviz as az
with pm.Model() as model2:
alpha = pm.Exponential('alpha', 5)
beta = pm.Exponential('beta', 5)
p_factor = pm.Gamma('p_factor', alpha = alpha, beta = beta, observed = d.productivity_factor)
prior_checks = pm.sample_prior_predictive(samples=100, random_seed= seed)
trace2 = pm.sample(2000, tune=2000)
I then plot a posterior predictive check
with model2:
ppc2 = pm.sample_posterior_predictive(trace2, var_names=["alpha", "beta",'p_factor'], random_seed=seed)
idata = az.from_pymc3(trace2, posterior_predictive=ppc2)
az.plot_ppc(idata)
but the observed curve does not match what I expect. Is there something I am doing wrong?