Categorical model with Dirichlet priors on parameters?

I’m not sure what they’re asking you to do make a whole lot of sense. I could be wrong, but here’s my take.

In Stan a categorical outcome with simplex parameter would look like:

parameters {
  simplex[4] theta;
}

model {
  theta ~ dirichlet([1, 1, 1, 1]');
  y ~ categorical(theta);
}

And like a dirichlet is a conjugate prior for the categorical distribution so we know the posterior is still a dirichlet and we don’t need Stan for this.

In the model you’re fitting, theta is not a parameter. You say theta is a function of other things. Your model is something like:

parameters {
  vector[N] beta;
  real intercept;
}

model {
  simplex[4] theta = softmax(beta * X + intercept);
  y ~ categorical(theta)

You put your briors on beta and the intercept (X is data).

I think it basically comes down to you’re doing the second thing, where you explain theta as a regression of other stuff. The first thing you’re just estimating theta, but there’s no explaining theta itself as a function of other things.

Now you might try to pick a prior on beta/intercept such that theta is dirichlet distributed without seeing data, but the easy way to do that is the change of variables described here: https://mc-stan.org/docs/2_21/reference-manual/change-of-variables-section.html, and that probably won’t work cause I doubt there’s an invertible function between theta and beta + intercept.

Anyway they might be suggesting you do this cause it seems like it would be easy, but I don’t think that is an easy thing to do.

I don’t think there’s any mechanism to do this in brms. That make sense? Or am I off base?

4 Likes