Bayesian logistic regression with horseshoe prior


I’d like to use the model from this recent paper by Piironen & Vehtari (, specifically the model in Appendix C2 for a logistic regression. I’ve adapted the script to my own data and to the model structure I’m interested in (which includes fixed effects and random effects for participants and trials).

What I seem to miss is where the following items come from:

real <lower=0> scale_global;  // scale for the half -t prior for tau
real <lower=1> nu_global;     // degrees of freedom for the half -t priors for tau
real <lower=1> nu_local;      // degrees of freedom for the half -t priors for lambdas
real <lower=0> slab_scale;   // slab scale for the regularized horseshoe
real <lower=0> slab_df;      // slab degrees of freedom for the regularized horseshoe

Since they appear in the data block I assume these variables are derived from the data set that I’m analyzing. But it’s not really clear to me where I should take them from.

Thanks in advance for your hints and ideas.

They are not derived from the data. Data block is often used also to pass user defined fixed parameter values, so that there is no need recompile Stan model if you want to change these.

The paper you refer is all about how to choose these parameters. The last section includes recommendations which can be translated as

scale_global = tau_0; // where tau_0 is computed using (3.12) and guess for p_0 
nu_global = 1;
nu_local = 1; 
slab_scale = s;   // where s is selected based on your prior information on magnitude of the largest coefficients
slab_df = 4;

Thanks for the explanation.
Things are a bit clearer now. Anyway I’ll dig more thoroughly into the paper to try and understand everything better.