data { int I; // number of question options (22) int N; // number of questions being asked by the user int K; // number of strategies // observed "true" questions of the user int q[N]; // array of predicted probabilities of questions given strategies // coming from the forward neural network matrix[I, K] P_q_S[N]; } parameters { // probabiliy vector of the strategies being applied by the user // to be inferred by the model here simplex[K] P_S; } model { for (n in 1:N) { // marginal probability vector of the questions being asked vector[I] theta = P_q_S[n] * P_S; // categorical likelihood target += categorical_lpmf(q[n] | theta); } // priors target += dirichlet_lpdf(P_S | rep_vector(1.0, K)); }