Apologies in advance for the imprecise language. I am attempting to sample a covariance matrix from a dataset with two variables X and Y (both standardized). When migrating from pymc2 to pymc3 the definition of the prior and models is easy:
with pm.Model() as model:
# assume an uniformative prior for rho between -1 and 1 and starting at 0 for the sampling
rho = pm.Uniform('rho', lower=-1, upper=1)
# the priors on our expected data values and starting point are derived from the data
mu1 = pm.Normal('mu1', 0.0, 1.0/(1000)**2.0, observed = x.mean())
mu2 = pm.Normal('mu2', 0.0, 1.0/(1000)**2.0, observed = y.mean())
sigma1 = pm.InverseGamma('sigma1', 11.0, 10.0, observed = x.std())
sigma2 = pm.InverseGamma('sigma2', 11.0, 10.0, observed = y.std())
but while in pymc2 I could define two deterministic functions
@pm.deterministic
def mean(mu1=mu1, mu2=mu2):
return np.array([mu1, mu2])
@pm.deterministic
def CoV(rho=rho, sigma1=sigma1, sigma2=sigma2):
ss1, ss2, rss = sigma1 * sigma1, sigma2 * sigma2, rho * sigma1 * sigma2
return [[ss1, rss], [rss, ss2]]
xy = pm.MvNormalCov('xy', mu=mean, C=CoV, value=data.T, observed=True)
Now the equivalent
mean_val = pm.Deterministic('mean value', [mu1, mu2])
CoV = pm.Deterministic('Covariance', [[sigma1**2.0, rho*sigma1*sigma2],[rho*sigma1*sigma2, sigma2**2.0]])
xy = pm.MvNormal('xy', mu=mean_val, cov=CoV, observed=data.T)
triggers an error
mean_val = pm.Deterministic('mean value', np.array([mu1, mu2]))
File "/scratch/home/pfigueir/anaconda3/envs/py37/lib/python3.7/site-packages/pymc3/model.py", line 1597, in Deterministic
var = var.copy(model.name_for(name))
TypeError: order not understood
That I think I should address by reformulating the question. Could you please help me?