Hello,
I am a newbie in stan, recently ran my model successfully and got the posteriors for parameters. I have a multinomial model and now I want to extract predicted probabilities.
data {
int<lower=1> D; // # of alternatives
int<lower=0> L; // Participants
int M[L]; // observed choice
matrix[L,D] X; // observed outcome
matrix[L,D] Z; // observed gain
}
parameters {
real mu;
real<lower=0> sigma;
real<lower=0> lambda;
real<lower=0> beta[L];
}
model {
//priors
mu ~ normal(0,1);
sigma ~ cauchy(0,1);
lambda ~ lognormal(0,1);
for (l in 1:L){
beta[l] ~ lognormal(mu, sigma);
M[l] ~ categorical_logit(to_vector(lambda*(Z[l])-beta[l]*(square(Z[l]-X[l]))));
}
}
For M[l] there are 6 (D) alternatives and I want to have predicted probabilities for each. I coudln’t find if there is a specified method for that with rstan and I couldn’t figure out how to do with posteriors for \mu, \sigma, \lambda and \beta.
I would appreciate any help and information on:
- Whether there is a certain method in rstan I can use to extract predicted probabiltiies?
- How can I calculate with posteriors?