# In the context of a MCMC: how to create/interpret a trace for a matrix?

In a Metropolis-Hastings algorithm, I'm drawing a matrix from a proposal. The accepted matrices should constitute draws from a posterior.

If it were just a parameter, I would know how to interpret its trace.

However, now I have a matrix. I'm thinking of just evaluating the accepted draws using a density from a matrix distribution, and then see how the plot varies. However, what should I be looking for?

• I will amend my answer below to account for any additional specifics you can provide, e.g., requirements for the model or the matrix or likelihood/data. – Peter Leopold Jul 2 '19 at 3:24

What should you be looking for? An acceptance ratio of 30-50%. Constancy of whatever invariants you hold dear. A familiar-looking distribution of your data's likelihood values, or perhaps the negative log likelihood, which is usually what you calculate and can interpret most directly (as energy/$$k_BT$$, for instance, in physics.) And you should make sure that the time-course of parameter values (matrix elements, trace, what-not) has an autocorrelation function with a characteristic decorrelation time much, much less than the duration of your simulation. That is, you should just be looking at all the standard diagnostics of M-H MCMC. The fact that your parameter space constitutes a set of matrix elements doesn't change any of this.
• Hi Peter, thanks for the answer. The matrix I'm trying to draw does not represent the full model. The remaining parameters mix well. This matrix is being drawn from an Inverse-Wishart, whose mean/mode is located at previous one plus a matrix taken at random (also from a IW): $\mu_{-1}+s_1*M$, where $s_1\sim \text{Unif}(0,1)$ – An old man in the sea. Jul 2 '19 at 9:27
• It seems that you might be modeling a covariance matrix. Covariance matrices are positive semi-definite; the set of positive semi-definite matrices is convex, so you are at liberty to perform the affine transformation you suggest. I'd still set $s_1 << 1$ small rather than random uniform $runif(0,1)$. Otherwise, you'll be jumping all over matrix space. Your acceptance rate will be low & you'll miss the wonderful "thermal equilibrium" sampling feature that M.-H. does best. A small $s_1$ means your selection of $M$ from the Inverse-Wishart can be unrestricted. Let the randomness reside there. – Peter Leopold Jul 2 '19 at 14:41
• Yes, it's a covariance matrix. I went back to my programme to check what I did. I misreported. I do fix $s_1$. I do $\mu_{-1}+s_1*M$, where $M\sim \text{IW}$. I still not sure I understood your suggestion for a rotation. Where do you multiply the rotation to $\mu_{-1}$, or $M$? In what direction/angle, randomly (uniformly?) selected? Could you please write in latex a formula? Thanks ;) – An old man in the sea. Jul 3 '19 at 7:39