paul-buerkner / brms

brms R package for Bayesian generalized multivariate non-linear multilevel models using Stan
https://paul-buerkner.github.io/brms/
GNU General Public License v2.0
1.27k stars 181 forks source link

Implementing the Skewed T-Distribution #513

Open abnormally-distributed opened 5 years ago

abnormally-distributed commented 5 years ago

The skew normal family is great for modeling skewed gaussian data, and the student t distribution is great for outliers. But if one has both skewed data and outliers, the skewed t-distribution might be quite useful! How practical would it be to implement this in brms? This paper outlines an implementation in an MLE/EM setting, but I'm not quite skilled enough to implement it in Stan myself.

https://en.wikipedia.org/wiki/Skewed_generalized_t_distribution#Skewed_t_distribution

paul-buerkner commented 5 years ago

I agree this sounds like an interesting distribution. Before I implement that in brms, however, I need to see a case study of someone implementing this in Stan efficiently and stable as I currently don't have the time to do that myself. Maybe ask at https://discourse.mc-stan.org/ if someone has experience with that distribution?

LailaKF commented 4 years ago

Hello, I was wondering whether there are news on the implementation of the skewed T-Distribution in brms?

Currently struggling with fitting a zero-loaded distribution with outliers (outcome is not a strict count variable but a "weighted" count, i.e., the product of memory occurence [1,2,3 times...] x Distress [on a scale 0-100]). Since negative values aren´t possible in my outcome, I was also thinking about the lognormal distribution, but then I´d still have to deal with outliers. Any way, if you happen to have any ideas, I´d be more than grateful!

paul-buerkner commented 4 years ago

I just didn't have time to look at many brms features issues currently out there. However, it is possible that you implement it yourself with a custom_family. If you have questions above that, please read the related vignette and then you may want to ask of https://discourse.mc-stan.org/

Ari04T commented 3 years ago

It seems like someone implemented this function in Stan a while ago. https://discourse.mc-stan.org/t/ideas-for-modeling-systematically-skewed-outliers/636/7

I've been using this distribution on the gamlss package and it seems to work quite well for moderately skewed data with outliers. I would give the implementation a shot but to be honest I'm just learning how to use brms, so I think this is beyond my abilities right now.

paul-buerkner commented 3 years ago

Great! Thank you! Would you consider try to implementing a custom family as a start (https://cran.r-project.org/web/packages/brms/vignettes/brms_customfamilies.html)?

trinhdhk commented 8 months ago

Having a similar problem so I created a proof-of-concept package over here: https://github.com/trinhdhk/sgtbrms

However, the current implementation requires Stan > 2.30 for inv_inc_beta to be available. The rstan on CRAN currently is using Stan 2.26 i think.

It is notable that compared with Carter Davis's sgt, I pre-transformed lambda $\in (-1, 1)$ into (lambda + 1)/2 so that it works with logit link. Consider adding atanh instead?