Multivariate Normal Conjugate Samplers for Linear Model Coefficients

5 views
Skip to first unread message

Maryclare Griffin

unread,
Aug 13, 2026, 11:25:28 AM (14 days ago) Aug 13
to nimble-users
Sorry in advance if this question has already been asked - I did a quick search and didn't see it, but may not have searched the right terms.

I'm trying to understand if nimble can detect multivariate normal conjugate samplers for linear model coefficients (assuming normal priors).  I tried several things and at one point thought nimble was correctly detecting the multivariate normal conjugate sampler, but upon review of this page, https://r-nimble.org/examples/linpred.html, I think it's not because of the sentence "Unfortunately at the moment, NIMBLE does not recognize conjugacy in this situation where the prior is dmnorm and the dependents are dnorm."

Are there any workarounds that can help with recognition of multivariate normal conjugate samplers? Or is it just necessary to define a custom sampler? 

Chris Paciorek

unread,
Aug 15, 2026, 4:59:44 PM (12 days ago) Aug 15
to Maryclare Griffin, nimble-users
Hi Maryclare,

The way to get the conjugate sampler in this case is to replace your various `dnorm` distributions for the dependents with a single `dmnorm` with a diagonal covariance or precision matrix. Then our MCMC conjugacy detection system should pick up the conjugacy. That will presumably require that you have a `for` loop that populates the individual elements of the mean vector and the diagonal of the matrix based on what you currently have as the individual means and variances/sds/precisions for the dnorm specifications.

I think that if you provide the precision (rather than covariance) matrix for the dependents' dmnorm that will result in more efficient internal calculations, though I haven't reminded myself of all the details there and (particularly for not-large models) may not make much difference.

-chris



--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/nimble-users/8e98a0ef-d215-4449-9c0b-b0885c82f101n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages