Using pm.MvNormal for setting prior distribution

Oh, I didn’t notice that delta was a vector. In that case, the below code should work

import numpy as np
import pymc3 as pm
import theano.tensor as tt

delta = np.array([8.30612523,8.40355324,8.50030771,8.59642241,8.69192957])
growth = np.array([3.20924e-05,3.25786e-05,3.46921e-05,3.34784e-05,4.08747e-05])

with pm.Model() as model_a:
    mu = [2.3075560664282255,-14.925081358163954]
    Cov = np.array([[0.0179,-0.0432517],[-0.0432517,0.108137]])

    x = pm.MvNormal('x', mu=mu, cov=Cov, shape=(1,2))
    c, m = tt.split(x, [1, 1], n_splits=2, axis=1)
    c = tt.squeeze(c)
    m = tt.squeeze(m)
    deltmu = pm.Deterministic('deltmu', c[0] * delta ** m[0])
    y = pm.Normal('y', mu=deltmu, sigma=0.1, observed=growth)
    trace_a = pm.sample(10, cores=1)
1 Like