Can someone kindly explain how to obtain the sampling variance-covariance matrix in brms

Hello,
I’m currently trying to estimate the precision (sampling variance) of the estimated average indirect effect: image which is computed as

image

I’m able to obtain all the estimates required to estimate the precision of the average indirect effect except the last term (image )

So my question is, is there a way to obtain the sampling variance of the covariance of aj and bj (Which are both random effects) in brms.

Thanks!

Is there a reason why you cannot compute these quantities from the posteriors? From your MCMC trace you can compute expected values, variance, or any summaries for any parameter, combination, or function of them. If that is not a quantity computed during estimation just compute a new vector with the and then compute its variance.

I think you could compute each term of the expression separately, since it follows from the properties of random variables, but it’s probably easier to just compute ab + \sigma for all samples and find the summaries from that.

You’re right! The solution was just here in front of my face! For some reason I made it more complicated than it should be!

1 Like

Glad it helped. Sometimes nice analytical expressions are derived from probability theory or statistics, but the frequentist approach still require you to find the summaries that are not always readily available. One of the coolest thing of Bayesian statistics has to be that you are always working with the posterior distributions, so it’s easy to visualize and think about the quantities of interest.