I have detection counts `X_{ij}` for species `i` at site `j`, where each site is visited `K` times. There are `n` observed species and an augmented superpopulation of size `S`. I want a multi-species occupancy model with latent species availability, species-specific occupancy and detection effects, and correlation between occupancy and detection on the species level.

My model is:
For species `i = 1, ..., S`,
`a_i ~ Bernoulli(Omega),`
where `a_i` indicates whether species i is available in the region.

Conditional on a latent bivariate species effect `(u_{i1}, u_{i2})`,
`logit(psi_i) = alpha + u_{i1},`
`logit(theta_i) = beta + u_{i2},`
and
`(u_{i1}, u_{i2}) ~ MultiNormal(0, Sigma_uv),`
with
`Sigma_uv = [[sigma_uv,1^2, rho_uv sigma_uv,1 sigma_uv,2], [rho_uv sigma_uv,1 sigma_uv,2, sigma_uv,2^2]].`

If species i is available, then at each site
`Z_{ij} ~ Bernoulli(psi_i),`
and conditional on occupancy
`X_{ij} | Z_{ij} ~ Binomial(K, Z_{ij} theta_i).`

The priors are
`alpha ~ Cauchy(0, 2.5),`
`beta ~ Cauchy(0, 2.5),`
`sigma_uv,d ~ half-Cauchy(0, 2.5), for d = 1, 2,`
`(rho_uv + 1) / 2 ~ Beta(2, 2),`
`Omega ~ Beta(2, 2).`

Here:
`X_{ij}` is the observed detection count for species i at site j,
`a_i` is the latent availability indicator for species i,
`Z_{ij}` is the latent occupancy indicator for species i at site j,
`psi_i` is the occupancy probability for species i,
`theta_i` is the detection probability for species i given occupancy,
`alpha` and `beta` are the population-level occupancy and detection intercepts,
`u_{i1}` and `u_{i2}` are the species-level occupancy and detection random effects,
`Sigma_uv` is the covariance matrix of the species-level random effects,
`rho_uv` is the correlation between occupancy and detection effects,
`sigma_uv` is the vector of species-level standard deviations,
`Omega` is the superpopulation availability probability,
`J` is the number of sites,
`K` is the number of visits per site,
`n` is the number of observed species,
`S` is the superpopulation size.

Parameterization notes:
In `Cauchy(mu, sigma)`, `sigma` is a scale parameter.
In `Beta(a, b)`, `a` and `b` are shape parameters.
