Hi, I try to follow Savage’s @James_Savage rank ordered logit approach to extract log-likelihood to calculate AIC or WAIC. The links to his approach is “https://khakieconomics.github.io/2018/12/27/Ranked-random-coefficients-logit.html”. However, I get the error when I write my code below saying rows of left-hand side does not match the row of the right-hand side at line(5). If I delete generated quantities, it runs correctly. Anybody can give me any suggestions?

generated quantities {
vector[N] log_lik;
for (n in 1:N) log_lik[n] = rank_logit_lpmf(rank_order[]| beta_individual[task_individual[n]]');
}

Hi @HCOKSTATE, one thing I notice is that your loop has for (n in 1:N) but on the right side there’s no n. I haven’t had a chance to go through all the code at the link, but my guess is that you need to index something on the right side with n also.