I’m new to stan (loving it so far), and somewhere between a beginner and intermediate with Bayesian modeling in general. I’m trying to fit a skew t distribution with some data. Stan does not have a skew t (or skew generalized t), but I found a couple of related posts on the topic here in forums.

One that seems useful is a chi-square skew normal mixture in this comment:

I’ll copy the code from that comment here for convenience:

```
library(rstan)
scode <- "
data {
real<lower=1> nu;
real alpha;
}
transformed data {
real sqrt_nu = sqrt(nu);
}
parameters {
real<lower=0> V;
real Z;
}
transformed parameters {
real T = Z * sqrt(V) * sqrt_nu;
}
model {
V ~ inv_chi_square(nu);
Z ~ skew_normal(0, 1, alpha);
}
"
foo_data <- list(nu = 4, alpha = 1)
```

But that does not seem to be designed to learn parameters from data. Instead it looks like parameters are being fed in as data. I was trying to modify it to fit parameters from observed data, but I’m getting errors, and I’m not sure how to proceed. Is this an easy challenge for someone here? Or can you point me to a reference that can help me make the conversion? Or any other suggestions or resources on how to fit a skew t distribution in stan?