Spike and Slab question

Stan does not support integer parameters; these need to be marginalized out. However, this generally doesn’t work well for the spike and slab, and it’s often (but not universally) recommended to use a horseshoe prior as a viable alternative. For more, see

See also your earlier post here

And this post

Note also that in your code where you have

beta1 ~ lambda*slab+(1-lambda*spike);

you are using the ~ sampling notation but the right-hand side is not a distribution (it’s just a number). This is in one sense a secondary concern since the spike-and-slab probably isn’t achievable in the way you want in the first place. In another sense, it’s important to understand what ~ does and why statements like this one don’t mean anything in the Stan language to support your future modeling endeavors in Stan.

1 Like