s-cunningham / GeeseBehavior-Weather

Code for manuscript "Time-varying effects of local weather on behavior and probability of breeding deferral in two Arctic-nesting goose populations" (Oecologia; 10.1007/s00442-022-05300-x)
GNU General Public License v3.0
0 stars 0 forks source link

Random year effects in stochastic antecedent models #1

Closed s-cunningham closed 2 years ago

s-cunningham commented 2 years ago

I have a random year effect in the stochastic antecedent models, but not sure if I have it set up correctly.

For example, ODBA model has: ## Priors for (i in 1:2) { beta0[i] ~ dnorm(0, tau.alpha) } tau.alpha <- 1/(sd.alpha*sd.alpha) sd.alpha ~ dunif(0,1) And: ## Likelihood for (i in 1:nind) { defer[i] ~ dbern(p[i]) logit(p[i]) <- beta0[year[i]] + beta1*antPTF[i] + beta2*pop[i] + beta3*antPTF[i]*pop[i] }

Model scripts: 11_StochasticAntecedentModels_ODBA.R 11_StochasticAntecedentModels_PTF.R

s-cunningham commented 2 years ago

There's only 2 years though after dropping 2012-2013 Greenland geese...is that enough for a random effect?

schafert commented 2 years ago

I would make the following edits:

## Priors
for (i in 1:2) {
beta0[i] ~ dnorm(mu_beta0, tau.alpha)
}
mu_beta0 ~ dnorm(0,1/10)
tau.alpha ~ dgamma(0.01, 0.01)

I'd only put mean 0 if we model the grand mean separately (then it's random effect as a difference from the mean). Also, dunif(0,1) is a bad prior for a standard deviation... It forces the variance to be no bigger than 1. I see quite a bit of code floating around using a dunif prior on the standard deviation (dunif(0,3) and dunif(0,5)), but I'm not sure where that is coming from... We could look into other priors, but this is what I default to

schafert commented 2 years ago

Also, it doesn't matter that there is only two years for the estimation. Whether or not it's necessary depends on the signal in the data

s-cunningham commented 2 years ago

Sounds good, thanks!