Thanks this is a great suggestion, because pm.Wishart indeed has a random function. I am not familiar with how to use it, but I gave it a try. I still have problem defining multiple structured, higher dimensional observations. MVNormal observations are fine, but I cannot stack multiple packed L and covariance matrices in the same way (along the first axis). Is there a keyword defining along which axis the observations are stacked? The code below runs up until the posterior prediction, but I doubt that it performs what my original goal was. Nu looks like a proper MCMC trace, but I guess V has to be another positive definite random matrix with a prior (another pm.Wishart?). I get an assertion error if I do that.
line1=np.array(df[[‘oddU11’,‘oddU12’,‘oddU13’]])
line2=np.array(df[[‘oddU12’,‘oddU22’,‘oddU23’]])
line3=np.array(df[[‘oddU13’,‘oddU23’,‘oddU33’]])
lendf=len(df)
bigmtx=np.zeros((lendf,3,3))
for i in range(0,lendf):
bigmtx[i]=np.array([line1[i],line2[i],line3[i]])
with pm.Model() as model:
nu = pm.Uniform(‘nu’, 0, 100)
V=bigmtx[0]/3.
#V=pm.Wishart(‘V’,nu=nu,V=bigmtx[0]/3.)
cov=pm.Wishart(‘cov’,nu=nu,V=V, observed=bigmtx[0])
with model:
trace = pm.sample(cores=1)
with model:
pm.sample_posterior_predictive(trace, samples=500)