Hello, I was wondering if it’s possible to utilize the simulator for two different observed data. I extend one of the examples to produce N x 2 observed data points.
# --------------------------------------------------------------------------- #
import numpy as np
import pymc as pm
# --------------------------------------------------------------------------- #
def normal_sim(rng, a, b, size=1000):
return rng.normal(a, b, size=(size, 2))
def analyze():
data = np.random.normal(loc=0, scale=1, size=(500, 2))
with pm.Model() as basic_model:
a = pm.Normal('a', mu=0, sigma=5)
b = pm.HalfNormal('b', sigma=1)
simulator = pm.Simulator(
's', normal_sim,
params=(a, b), sum_stat='sort', epsilon=1,
observed=data)
idata = pm.sample_smc(chains=4)
if __name__ == '__main__':
analyze()