1 1 Supporting information S1. OpenBUGS code for the multistate capture-recapture model for 2 riverine diadromous fish dispersal 3 4 model { # modified from Kery and Schaub (2011) 5 # PARAMETERS 6 # STATES 7 # M – monthly instantaneous rate of natural mortality (constant over sampling periods) 8 # d – immediate mortality from capture and tagging 9 # z – latent variable (live or dead) 10 # psi[1, ] – probability of leaving state 1 (upstream transition) 11 # psi[2, ] – probability of leaving state 2 (downstream transition) 12 13 # OBSERVATIONS 14 # alpha – electrofishing recapture probability 15 # beta – PIT array capture probability 16 17 # PRIORS 18 # STATE PARAMETERS 19 M ~ dgamma(0.001,0.001) 20 d <- Mortalities/Caged 21 for (s in 1:2) { 22 for (t in 1:n.occasions-1) { 23 psi[s,t] ~ dbeta(1,1) 2 24 psi[s,t] ~ dbeta(1,1) }} 25 26 # STATE PARAMETER CONSTRAINTS 27 for (i in 1:nind){ 28 phi[i,first[i]] <- (1-d) * exp(-(m[i]*M+(g[first[i]]-1)*M)) 29 for (t in (first[i]+1):(n.occasions-1)){ # loop over time 30 phi[i,t] <- exp(-g[t]*M) }} 31 32 # OBSERVATION PARAMETERS 33 for (j in 1:n.array) { # PIT array priors 34 for (t in 2:n.occasions){ 35 36 alpha[j,t] ~ dbeta(1,1) }} beta ~ dbeta(1,1) # Electrofishing prior 37 38 # LIKELIHOOD 39 # STATE PROCESS: SURVIVAL AND STATE TRANSITIONS 40 for (i in 1:nind){ 41 42 for (t in first[i]:(n.occasions-1)){ # 1st index = recap type,2nd index = states at time t-1,last index = states at time t 43 ps[1,i,t,1] <- phi[i,t] * (1-psi[1,t]) 44 ps[1,i,t,2] <- phi[i,t] * psi[1,t] 45 ps[1,i,t,3] <- 1-phi[i,t] 46 ps[2,i,t,1] <- phi[i,t] * psi[2,t] 3 47 ps[2,i,t,2] <- phi[i,t] * (1-psi[2,t]) 48 ps[2,i,t,3] <- 1-phi[i,t] 49 ps[3,i,t,1] <- 0 # Dead 50 ps[3,i,t,2] <- 0 51 ps[3,i,t,3] <- 1 52 53 # OBSERVATION PROCESS 54 # 1st index = Obs. matrix, 2nd index = states at time t, last index = observations at time t 55 po[1,1,i,t,1] <- alpha[1,t] # Observed at coastal plain PIT array 56 po[1,1,i,t,2] <- 0 57 po[1,1,i,t,3] <- 1- alpha[1,t] 58 po[1,2,i,t,1] <- 0 59 po[1,2,i,t,2] <- alpha[2,t] # Observed at foothills PIT array 60 po[1,2,i,t,3] <- 1- alpha[2,t] 61 po[1,3,i,t,1] <- 0 62 po[1,3,i,t,2] <- 0 63 po[1,3,i,t,3] <- 1 # Dead 64 65 po[2,1,i,t,1] <- 0 66 po[2,1,i,t,2] <- 0 67 po[2,1,i,t,3] <- 1 68 po[2,2,i,t,1] <- 0 69 po[2,2,i,t,2] <- alpha[3,t] # Observed at mountains PIT array 4 70 po[2,2,i,t,3] <- alpha[3,t] 71 po[2,3,i,t,1] <- 0 72 po[2,3,i,t,2] <- 0 73 po[2,3,i,t,3] <- 1 # Dead 74 75 po[3,1,i,t,1] <- beta # Coastal plain electrofishing recaptures 76 po[3,1,i,t,2] <- 0 77 po[3,1,i,t,3] <- 1-beta 78 po[3,2,i,t,1] <- 0 79 po[3,2,i,t,2] <- beta # Foothills and mountains electrofishing recaptures 80 po[3,2,i,t,3] <- 1-beta 81 po[3,3,i,t,1] <- 0 82 po[3,3,i,t,2] <- 0 83 po[3,3,i,t,3] <- 1 } # Dead 84 85 z[i,f[i]] <- Y1[i,first[i]] 86 for (t in (first[i]+1):n.occasions){ 87 z[i,t] ~ dcat(ps[z[i,t-1], i, t,]) # alive (1) or dead (0) 88 Y1[i,t] ~ dcat(po[1,z[i,t], i, t, ]) # transitions to other states 89 Y2[i,t] ~ dcat(po[2,z[i,t], i, t, ]) 90 Y3[i,t] ~ dcat(po[3,z[i,t], i, t, ]) }} 91 92 } 5 93 94 95 96 References Kery, M. & Schaub, M. 2011. Bayesian Population Analysis Using WinBUGS. Waltham, MA: Academic Press.