I wonder how to define a dicrete distribution in stan.For instance,there is a distribution where P(y=1)=0.2,P(y=2)=0.3,P(y=3)=0.5. Thanks for any help!
1 Like
Is y an ordinal outcome?
If you have a fixed set of categories and you know the probabilities, then categorical
is the distribution you are looking for. Note that in general to define a distribution, you need to provide the log-probability (for discrete distributions) or the log-density (for continuous distributions). So once you compute the probability, simply target += log(probability);
will work (in fact that’s exactly what y ~ categorical(all_probabilities)
will do).
Best of luck with your model!
2 Likes