How to specify a scaled-t family in brms (R)?

Hi everyone !

I built a model with the gam function from MGCV using the scat family because my Y variable is heavily tailed (https://rdrr.io/cran/mgcv/man/scat.html). The residuals of the model are fine, and almost normal.

I tried to build the same model with brms but scat family is not implemented. So, I gave a try with the student family, but the residuals of the new model have a stronger kurtosis value. With 4000 observations, in a bayesian framework, is it a problem ?

I found that brms allows to specify custom families and a vignette explains the process : https://cran.r-project.org/web/packages/brms/vignettes/brms_customfamilies.html. Sadly, I am not able to fully understand it.
Does someone know how I could use it to specify the same scat family as in MGCV ?

Thank you a lot !

  • Operating System : windows 10
  • brms Version : 2.6.0

Are you sure that mgcv::scat does not implement that same family as brms::student? From the doc of mgcv they appear the same to me.

1 Like

Dear @paul.buerkner,

First, thank you a lot for your answer and your time !

So, I checked the brms vignette about distributions and the density function of the student family, but I couldnā€™t find the same thing for the mgcv::scat family. If you feel that they are the same, I trust you, but I have a little doubt about the ā€œscaledā€ term in the mgcv family name. I tried to look at the source of the scat function but itā€™s a little bit messy.
There is this link https://www.rdocumentation.org/packages/metRology/versions/0.9-23-2/topics/Scaled%20t%20distribution, wich shows an other implementation of the scaled t distribution : ā€œStudentā€™s t distribution for ā€˜dfā€™ degrees of freedom, shifted by ā€˜meanā€™ and scaled by ā€˜sdā€™ā€

Yeah I am pretty sure they are the same. ā€œscaledā€ is only special if you are used to standardized t-distributions for t-tests.

The t-distribution in Stan and brms are always scaled otherwise we couldnā€™t use them as drop-in replacements of the Normal distribution.

1 Like

Ok, thank you very much ! Iā€™m just surprised to have so much differences in my residuals distribution, I have to inspect this to understand where the problem come from.