Hi,
I’m having a similar AssertionError issue when using the logcdf method for a Beta, but strangely not for a Normal. Here is my Code:
# Initialize random number generator
np.random.seed(123)
# True parameter values
alpha, sigma = 1, 1
beta = [1, 2.5]
# Size of dataset
size = 100
# Predictor variable
X1 = np.random.randn(size)
X2 = np.random.randn(size) * 0.2
# Simulate outcome variable
data = alpha + beta[0]*X1 + beta[1]*X2 + np.random.randn(size)*sigma
>
basic_model = pm.Model()
with basic_model:
a = pm.Normal('a', mu=2, sd=2)
b = pm.Normal('b', mu=2, sd=2)
s = pm.HalfNormal('sigma', sd=0.01)
m1 = np.exp(pm.Beta.dist(alpha=a, beta=b).logcdf(0.1))
Y_obs = pm.Normal('Y_obs1', mu=m1, sd=s, observed=data)
map_estimate = pm.find_MAP(model=basic_model)
print map_estimate
with basic_model:
# Sample from the posterior
trace = pm.sample(draws=1000, chains=2, tune=500, discard_tuned_samples=True)
pm.plot_posterior(trace)