## model "Double" used in: ## Extracting More out of Relocation Data: Building Movement Models as Mixtures of Random Walks ## Juan Manuel Morales, Daniel T. Haydon, Jacqui Frair, Kent E. Holsinger and John M. Fryxell ## contact juan.morales@uconn.edu model{ ## priors b[1] ~ dgamma(0.01,0.01) ## shape parameter for slow movement b[2] ~ dgamma(0.01,0.01) ## shape parameter for fast movement a[2] ~ dgamma(0.01, 0.01) ## scale parameter for fast movement eps ~ dnorm(0.0, 0.01)I(0.0,) ## a nonnegative variate a[1] <- a[2] + eps ## scale parameter for slow movement rho[1] ~ dunif(0,1) ## mean cosine of turns for slow movement rho[2] ~ dunif(0,1) ## mean cosine of turns for slow movement mu[1] ~ dunif(-3.14159265359, 3.14159265359) ## mean direction of turns for slow movement mu[2] ~ dunif(-3.14159265359, 3.14159265359) ## mean direction of turns for fast movement Pi <- 3.14159265359 ## define pi for (t in 1:npts) { nu[t,1] ~ dunif(0,1) ## probability of being in movement state 1 at time t nu[t,2] <- 1 - nu[t,1] idx[t] ~ dcat(nu[t,]) ## idx is the latent variable and the parameter index ## likelihood for steps l[t] ~ dweib(b[idx[t]], a[idx[t]]) # Weibull distriution for step length ## likelihood for turns. ## use the “ones” trick (see WinBUGS manual) to sample from the Wrapped Cauchy distribution ones[t] <- 1 ones[t] ~ dbern(wC[t]) ## below is the pdf for Wrapped Cauchy distribution, divided by 500 (arbitrary) to ensure that wC[t] will be less than one wC[t] <- ( 1/(2*Pi)*(1-rho[idx[t]]*rho[idx[t]])/(1+rho[idx[t]]*rho[idx[t]]-2*rho[idx[t]]*cos(theta[t]-mu[idx[t]t])) )/500 } }