Hi all,
I am trying to build a Multivariate Normal model where the two covarying parameters are instances of the same population and need to have the same associated variance. I could not find any other discussion dealing with this, apologies if I missed it.
I first thought that this could be achieved by simply setting to 1 the shape of the distribution for the standard deviations in the distribution of the LKJ correlations like this:
import pymc as pm
import aesara.tensor as at #using an older pymc version
sd_dist = pm.Exponential.dist(1, shape=(1, ))
chol, corr, stds = pm.LKJCholeskyCov(
"chol_cov",
eta=2,
n=2,
sd_dist=sd_dist
)
But this does not seem to force the model to recognize that the distribution of the variances is a single one? Although I might be not interpreting this correctly.
Alternatively I guess that one needs to build the covariance matrix “manually” from the correlation matrix using something like this?
chol, corr, stds= pm.LKJCholeskyCov(
"chol_cov",
eta=2,
n=2,
sd_dist=pm.Exponential.dist(1)
)
sigma = pm.Exponential("sigma", 1)
cov = pm.Deterministic("cov", var=(
pm.math.dot(
at.diag(at.stack([sigma, sigma])),
pm.math.dot(
corr,
at.diag(at.stack([sigma, sigma]))
)
)
)
Could the covariance in this form be directly multiplied by the z-offset in a non-centred model?
Thanks!