Hi I've been recently introduced to Bayesian Analysis, and Stan.

As a practice problem I was hoping to to model what is most likely average rating that a product will receive. By product ratings I mean and integer distribution with values bounded to [1,2,3,4,5].

Initially i thought that product ratings will be best described by multinomial distribution but I see in Stan's documentation that it accepts just one parameter theta which I cannot find information on on the web, wiki for example says that this distribution is described by p and N.

So my question is what would be an appropriate distribution to use here?

See bellow for my STAN model so far:

data {
  int<lower=1> N;
  int[N] ratings;
parameters {
  real mean;
model {
  ratings ~ multinomial(mean);

It would probably be best to model such an outcome as ordinal (usually with either the standard logistic or standard normal CDF as the mapping function). There in an example in section 9.8 of the Stan User's Manual. However, if you are just starting out with Stan and estimating simple models such as this one, it is often better to use the stan_polr function in the rstanarm R package or the brm function in the brms R package, which both use Stan to estimate ordinal models using only R syntax rather than Stan syntax.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.