The main source of your divergences is probably this part:
target += multinomial_logit_lpmf(Coded[N] | [0, muBuilding[N], muCaregiver[N], muPatient[N],
muPatientpsych[N], muSDOH[N], muCanmeds[N],
muExpertise[N], muRecommendations[N]]');
}
Because N
is just the total number of individuals, you’re only specifying the multinomial_logit_lpmf
prior for the very last individual. You’ll need to have this as a loop (which is what I think it used to be?) and that should be a bit nicer with the divergences