Created
October 7, 2019 17:52
-
-
Save monogenea/92b225339b7965f05dae5998f58d9bfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eggsFMod <- map2stan(alist( | |
Eggs_fledged ~ dzipois(p, lambda), | |
logit(p) <- ap, | |
log(lambda) <- a + a_fem[female_id] + a_year[year_id] + a_group[group_id] + | |
Parasite*bP + Min_age_Z*bA + Group_size_Z*bGS + Mean_eggsize_Z*bES + | |
Parasite*Min_age_Z*bPA, | |
Group_size_Z ~ dnorm(0, 3), | |
Mean_eggsize_Z ~ dnorm(0, 3), | |
a_fem[female_id] ~ dnorm(0, sigma1), | |
a_year[year_id] ~ dnorm(0, sigma2), | |
a_group[group_id] ~ dnorm(0, sigma3), | |
c(sigma1, sigma2, sigma3) ~ dcauchy(0, 1), | |
c(ap, a) ~ dnorm(0, 3), | |
c(bP, bA, bGS, bES, bPA) ~ dnorm(0, 2)), | |
data = fro, | |
iter = 5e3, warmup = 1e3, chains = 4, cores = 4) | |
# Check posterior dists | |
precis(eggsFMod, prob = .95) # use depth = 2 for varying intercepts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment