Sampling from a multivariate logistic distribution

I am trying to implement a multivariate logistic function into Stan and
figured I will need the following things in order to make the desired
likelihood function.

v Degrees of freedom
p Dimension of y
T_{p,v} ~ Multivariate T
g_v() Inverse CDF T
\phi^{-1} ~ \Gamma^{-1} (v/2,v/2)
z_{j} = log{\frac{F(\phi^{-1}e_j)}{(1-F(\phi^{-1}e_j))}}
e_1..e_p ~ Multivariate Normal N(0,R)
F(e_j) ~ Uniform distribution (0,1)
L() ~ Logit
R Covariance matrix of e_1..e_p

Some of these are easily accessible by using predefined functions
in Stan. However I’m wondering if it is possible to obtain the
Inverse CDF of a T distribution in an efficient way. Also I do not quite
understand how to sample from a distribution that is undefined. The model
I want to use is build up like this for the p-dimensional case:

Multivariate_logit = T_{p,v} ( g_v(z_1-\mu_1),...,g_v(z_p-\mu_p) ) | 0, R) \times \prod_{j=1}^p [{L(z_j|\mu_j)}/ {T_{1,v}(g_v(z_j-\mu_j)|0,1)}]

So the first part is a multivariate T distribution multiplied by scaling the
univariate logit model by a univariate T distribution. You can see that if
the number of dimensions is p=1, only L(z_1|\mu_1) remains, hence the univariate
logit distribution.

To summarize, does the inverse CDF of the T distribution exist in Stan?
Are there any alternative approaches to solve this. Would it be possible
to define a model in the way defined above and sample from this?
Is it likely that this would lead to efficient sampling?

1 Like

I don’t think so. The student-t functions are documented here: https://mc-stan.org/docs/2_20/functions-reference/student-t-distribution.html

The steps would be:

  1. Can you write out the log density of the thing you want to sample?
  2. Are the variables you want to sample continuous?
  3. Can you express the constraints you need on those variables in the Stan language?

If so, ideally yes. If not, no.

It’s possible that practical things like inverting a CDF that is numerically finicky make this impossible to do in Stan.

This is a description of the algorithm from which all the Stan algos are derived: https://mc-stan.org/docs/2_20/reference-manual/hamiltonian-monte-carlo.html . Keep in mind it’s all about incrementing a log density.

Here are a couple other sections in the manual that talk about this in terms of the Stan model syntax: https://mc-stan.org/docs/2_19/reference-manual/increment-log-prob-section.html, https://mc-stan.org/docs/2_19/reference-manual/sampling-statements-section.html

That help at all? You can surround things with dollar signs to use \LaTeX math or double dollar signs to center. You can use tick marks to write preformatted code too.