Dear All,
I would like to produce random covariance matrices in order to make pairwise comparison between them. I am looking for chances of accidental similarity. These random matrices would be inspired by experimental covariance matrices, so I would like to infer the joint sd and eta parameters and make posterior predictions along the lines shown below.
Problem 1:
I do not know how to feed multiple observed matrices to LKJCholeskyCov distribution, I get a dimension error when I trying to use more than one packed Ls.
Problem 2:
The LKJCholeskyCov distribution does not have a random function therefore the sample_ppc does not work. This would not be problem if sd is recorded in the trace, but I do not know how to achieve that in this example.
I wonder if there are solutions or workarounds for these problems. Does it make sense what I am trying to do?
Gergely
with pm.Model() as model:
eta=pm.HalfCauchy(‘eta’,beta=2.5)
sd=pm.HalfCauchy.dist(beta=2.5, shape=3)
obs=np.array(df[[‘oddU11’,‘oddU12’,‘oddU22’,‘oddU13’,‘oddU23’,‘oddU33’]])[0]
packed_L = pm.LKJCholeskyCov(‘packed_L’, n=3, eta=eta, sd_dist=sd, observed=obs)
with model:
trace = pm.sample()
with model:
pm.sample_ppc(trace)
obs looks something like this:
array([[ 9.860e-02, -1.310e-02, 9.990e-02, 1.850e-02, -1.190e-02,
1.091e-01],
[ 9.020e-02, -1.310e-02, 1.003e-01, 2.340e-02, -1.660e-02,
1.109e-01],
[ 1.069e-01, -2.400e-03, 8.370e-02, 2.360e-02, -8.800e-03,
1.154e-01],
…,
[ 8.000e-04, 0.000e+00, 2.400e-03, 1.000e-04, -1.000e-04,
1.400e-03],
[ 7.000e-04, 0.000e+00, 2.200e-03, 3.000e-04, 0.000e+00,
1.200e-03],
[ 1.100e-03, 0.000e+00, 1.800e-03, -1.000e-04, 2.000e-04,
1.700e-03]])