The ppc plot itself looks fine but it is the mean that looks weird:
ppc mean line plot has been known to act weird, see for instance:
I have had similar issues from time to time so I am assuming this is not fixed but there seems to be some suggestions in the links above (my solution is not to plot it!).
Just to double check, I have also ran this model on simulated data and it does seem to run fine in terms of ppc and posterior but the mean line is still bad:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 7 10:30:58 2024
@author: avicenna
"""
import numpy as np
import pymc as pm
import arviz as az
seed = 0
rng = np.random.default_rng(seed)
alpha_real = 1.35
N=100
with pm.Model() as sim:
data_dist = pm.Pareto("data_dist", alpha=alpha_real, m=1)
data = pm.draw(data_dist, N)
with pm.Model() as example:
x = pm.Data('x', data, mutable=True)
alpha = pm.LogNormal("a", )
likelihood = pm.Pareto('likelihood', alpha=alpha, m=x.min(), observed=x)
with example:
trace = pm.sample(1000, tune=1000, chains=6)
az.plot_posterior(trace)
with example:
pm.sample_posterior_predictive(trace, extend_inferencedata=True)
ax = az.plot_ppc(trace)#
ax.get_figure().savefig("ppc3.png")
ax = ax.plot_posterior(trace)
ax.get_figure().savefig("post.png")