Spike and slab

Hi, I’m new to Stan. Was wondering if there’s a simple way to incorporate spike and slab priors? For example, if I want to put a spike and slab on beta with the slab being a Gaussian one, what syntax might be used?


See (finnish) horseshoe prior

1 Like

Thanks for your reply. I was however wondering whether there’s any way to fit precisely the spike and slab prior instead of some continuous modification of it. Essentially the broader question is to use a mixture of discrete and continuous distributions as a prior for a parameter.

do you mean

beta ~ normal(1,1);
beta ~ bernoulli(0.01);


target += (normal_lpdf(1,1) + bernoulli_lpmf(0.01)) / 2;

I’m pretty sure this compiles and runs; if it converges / is good idea is another question

See this thread. I’m in the process of adding some more code to the linked Github repository and I somewhat concur with @aleshing’s claim that the model, as implemented, is wrong. It’s just a special case where c_i = 1 (see paper linked in @aleshing’s post in the other thread), which admittedly is not the most interesting case.

If you wanna help out, please give me a shout.