I would like to use the following kind of prior in a Stan simulation

$$ f_{K \mid G} (k \mid g) = \frac{1}{I_g(b,D)}|k|^{\frac{b-2}{2}} \exp \biggl \{ -\frac{1}{2} \text{tr} (Dk) \biggr \}\mathbb{1}_{P_g}(k)$$

where, for $p \in \mathbb{N}$, $k$ is a real valued $p \times p$ matrix, $b >2$, $b \in \mathbb{N}$, $D$ is a real valued $p \times p$ positive definite matrix and $g =(V_g,E_g)$ is an undirected graph with $V_g= \{1, \dots, p\}$ vertexes and $E_g \subset V_g \times V_g$ edges. The set $P_g$ is defined as follows: $$ P_g := \{ A \in S_+(p) \mid A(i,j)=0 \Leftarrow (i,j) \in V_g\times V_g \setminus E_g \}$$ where $S_+(p)$ is the set of real valued $p \times p$ positive definite matrices. Here $I_g(b,D)$ is the normalization constant for the distribution. $b$ and $D$ are known parameters but $G$ is distributed as the uniform on the space of graphs with $p$ nodes. This kind of prior is taken from the article "Mohammadi and Wit, Bayesian Structure Learning in Sparse Gaussian Graphical Models".

The problem is the calculation of the normalizing constant. I can obtain simulation of this prior from an other software but how to put it into stan?


1 Answer 1


If $b$ and $D$ are known, then you can do without the normalizing constant in Stan and just do target += 0.5 * (b - 2) * log_determinant(k) - 0.5 * sum(diagonal(D * k)); If $D$ is known but not $b$, then you can possibly marginalize $b$ over integers greater than 2 (up to some large but finite limit). If $D$ is not known, then omitting the normalizing constant would invalidate the resulting posterior draws. You need some sort of a deterministic approximation for the log normalizing constant.

  • $\begingroup$ Thank you for your answer. I'm sorry if it was not clear from my question but $b$ and $D$ are known parameters. On the other hand $G$ is a graph distributed as the uniform on the space of graphs with $p$-nodes. Then I cannot omit the normalization constant. Am I wrong? $\endgroup$
    – Bremen000
    Jan 4, 2019 at 17:52
  • $\begingroup$ I believe you are right, but I haven't read the Mohammadi and Wit paper. The first challenge would be constructing a $k$ matrix from the admissible region defined by $P_g$. If the volume of that set depends on unknowns, then you need to account for its logarithm in Stan. $\endgroup$ Jan 4, 2019 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.