Updating multivariate priors

Hi flurinus-

I don’t the parameters are fully capturing what you want. In particular, updating the eta parameter of the LKJ distribution specifies the concentration of the correlations – but not the form of the matrix. That is, in pymc3’s implementation, each entry of L is treated as exchangeable by the LKJ (there are other parametrizations which take in both eta and a covariance matrix). After observing some data, it is almost surely the case that the entries of L are not exchangeable, in which case you would want to model their joint distribution more explicitly.

A simple way would be a multivariate approximation to L itself:

L_μ = trace['packed_L'].mean(axis=0)
L_Σ = np.cov(trace['packed_L']) + 1e-3 * np.diag(np.ones(L_μ.shape[0])) # a little regularization
L_cholL = np.linalg.cholesky(L_Σ)
with pm.Model() as update_model:
    packed_L = pm.MvNormal('packed_L', mu=L_μ, chol=L_cholL)
    L = pm.Deterministic("L", pm.expand_packed_triangular(2, packed_L))
    ...
1 Like