The `multi_student_t`

function has a `nu`

argument accepting a real value that influences how heavy-tailed the distribution is, but I’d like to be able to accommodate multivariate data that has a different degree of heavy-tailed-ness in each dimension. I vaguely recall someone already solved this in a prior post but I’m having trouble finding it now. Any suggestions?

The basic idea is to use univariate Student t marginal distributions with different numbers of degrees of freedom and a multivariate copula to capture the dependence, which is discussed in

https://scholar.google.com/scholar?cluster=1395612595769919176&hl=en&as_sdt=0,33

I actually found the thread, which turned out to be over in the old google group:

https://groups.google.com/d/msg/stan-users/nk03n8hX4Us/-pTN5IGjCQAJ

You indicate there that “you don’t really need to utilize a copula for this but copulas would be interesting for other reasons”; care to elaborate?

Oops, I guess that thread was regarding the regular ol’ multi_student_t, but I followed up here on the different df’s per dimension case.

Ah, I now remember where I got stuck last time I looked at this. The code worked out in the linked google thread (and below) achieved expressing a model *parameter* as mult_student_t-with-different-nu-per-dimension, but I’m having trouble working out how to express a *data variable* as thus distributed. Any suggestions?

For posterity, here’s the code from the google thread:

```
data {
int<lower=1> p; //number of dimensions
vector[p] mu; //mean
cholesky_factor_cov[p,p] L; //cholesky factor of the covariance
vector<lower=0>[p] nu; //nu per dimension
}
parameters {
vector[p] z; //helper variable, to be normal(0,1)
vector<lower=0>[p] u; //helper variable, to be chi_square(nu)
}
transformed parameters {
vector[p] x;
// implies x ~ multi_student_t_2
x = mu + sqrt(nu / u) * (L * z);
}
model {
z ~ normal(0, 1);
u ~ chi_square(nu);
}
```

You should have what you need to make this happen.

I think there’s something funky with sqrt(nu / u), cause if that’s a vector and L * z is a vector, I don’t see how they multiply together. Assuming that sqrt(nu / u) stuff can get crammed in L, call that \hat{L}.

Anyway, so you can evaluate p(z), but what you have is x and a 1-to-1 transformation between x and z. In terms of the multivariate change of variables in the manual (pg. 403 of 2.17) that is:

x = \mu + \hat{L} z = f(z)

p_x(x) = p_z(f^{-1}(x)) | \text{det} J_{f^{-1}}(x)|

Then

z = \hat{L}^{-1}(x - \mu) = f^{-1}(x)

J_{f^{-1}}(x) = \hat{L}^{-1}

\text{det} \hat{L}^{-1} = \frac{1}{\text{det} \hat{L}}

And the determinant of a lower triangular matrix is just the product of the diagonal elements.

`x = mu + sqrt(nu ./ u) .* (L * z);`

I’m interested also in multi student t with df per dimension and found this through search. Copulas are new to me. However, reading the past linked google group thread - am I correct in saying the solution posted above stops short of using a copula ?