I am trying to sample from a multivariate exmodified gaussian but somehow I keep getting bad initial energy error. I tried checking FAQ’s and also the workflow suggested by @ junpenglao however, I am not able to figure out if there some misspecification in my model.
with pm.Model() as exp_mod_mdel:
# Priors
ν = pm.InverseGamma('ν', alpha=5)
β = pm.Normal('β', 0, sd=10, shape=len(X.columns))
σ = pm.InverseGamma('σ', alpha=3)
#Liklihood mean
μ = pm.Deterministic('μ', pm.math.dot(X, β))
# Likelihood
likelihood = pm.ExGaussian('y', mu=μ, sigma=σ, nu=ν, observed=y)
# Inference!
#trace = pm.sample(2000, tune=500, cores=2)
Running logp, dlogp = step.integrator._logp_dlogp_func(q0)
tells me that logp is infinite, however when I check the test values for example using np.sum(~np.isfinite(μ.tag.test_value))
I do not find any non-finite values (I check this for all of my variables ).
I find that ‘y’ is infinite by running, exp_mod_mdel.check_test_point()
, however, as I said using values of parameters, μ = 0, σ = 0.26, ν = 0.16
found using tag.test_value
, gives me finite log pdf through:
import scipy.stats as st
x = np.linspace(-6, 9, 200)
log_pdf = np.log(st.exponnorm.pdf(x, ν.tag.test_value, loc=0, scale=σ.tag.test_value))