Hi everyone,
just wanted to get some feedback regarding the issue with my mixture model setup. I’m trying to fit data with a mixture model, consisting of two truncated components. Even in the case where I mock up the data myself (based on a combination of random samples from the two mixture components) and hence know the input parameters, the models do not converge. Starting with priors close the actual values doesn’t help much, either.
Even if i skip the truncation part and only want to fit the non-truncated (i.e. regular) distributions to the data, it doesn’t really work, so I’m not sure what the issue here is.
Any help is appreciated!
with pm.Model() as model:
#Specify prior distributions
#For LogNormal
mu1 = pm.TruncatedNormal(‘mu1’,mu=1,sigma=1,lower=0.01,upper=10)
tau1 = pm.TruncatedNormal(‘tau1’,mu=1,sigma=1,lower=0.01,upper=5)
#For Pareto
alpha3 = pm.TruncatedNormal(‘alpha3’,mu=1,sigma=0.1,lower=0.01)
mu3 = pm.TruncatedNormal(‘mu3’,mu=5e4,sigma=1e4,lower=0.01)#Define Mixture components
lognormal_dist = pm.LogNormal.dist(mu=mu1,tau=tau1)
pareto_dist = pm.Pareto.dist(m=mu3,alpha=alpha3)components = [
lognormal_dist,
pareto_dist
]
#Weights of Mixture components
w = pm.Dirichlet(‘w’,a=np.array([1,1]))
like = pm.Mixture(‘likelihood’,w=w,comp_dists=components,observed=df)
trace = pm.sample()
trace.extend(pm.sample_posterior_predictive(trace))
trace.extend(pm.sample_prior_predictive())