# Define log likelihood for CJS model in Stan

FYI, I'm new to Stan and this is my first question here.

I'm unsure how to calculate the log likelihood for a Cormack-Jolley-Seber model in Stan. Can anyone help me with this?

Background: I've made 4 models all using this as the foundation. Model 1. - two populations with same phi and p. Model 2. - same phi, but different p, etc. I would like to evaluate models with WAIC via the loo package in R, but it requires defining the log likelihood within Stan's "generated quantities" block. Here is an example of this being done for a logistic regression model. Let me know if I can provide further clarification. Thanks!