Skip to content

Commit

Permalink
Added 400 m buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
nthaydt committed May 26, 2019
1 parent 3e70631 commit c4a5550
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 67 deletions.
42 changes: 23 additions & 19 deletions Code/JAGS/SCR_Allsites.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@

model {

for(g in 1:length(Sites)) {

alpha1[g, t] ~ dnorm(mu_a1, 1 / sd_a1 / sd_a1 )
mu_a1 ~ dnorm(0, 1 / (25^2))I(0, ) ## half normal
sd_a1 ~ dunif(0, 5)
mu_a2 ~ dnorm(0, 0.01)
# sd_a2 ~ dt(0, pow(5, -2), 1)T(0, ) # half cauchy prior with scale = 5 (25?)
sd_a2 ~ dunif(0, 5)

for(g in 1:n_sites) {

for(i in 1:M) {
Sex[g, i] ~ dbern(psi.sex[g])
Sex2[g, i] <- Sex[g, i] + 1
}

for(t in 1:2){
sigma[g, t] <- pow(1 / (2*alpha1[t]), 0.5) # sd of half normal
alpha1[g, t] ~ dnorm(0, 1 / (25^2))I(0, ) ## half normal independent across sites and sexes
# alpha1[g, t] ~ dnorm(mu_a1, 1 / sd_a1 / sd_a1 )I(0, ) # BUGS I(,) notation is only allowed if all parameters are fixed
sigma[g, t] <- pow(1 / (2*alpha1[g, t]), 0.5) # sd of half normal
} # t

psi[g] ~ dunif(0, 1) # giving numbers between 0 and 1,
psi[g] ~ dunif(0, 1) # prob of individual being in the population (for augmentation since N unknown)
# logit(psi[g]) ~ dnorm(mu_psi, 1 / sd_psi / sd_psi) # consider drawing from a normal distribution across sites
# mu_psi ~ dnorm(0, 0.01)
# sd_psi ~ dunif(0, 10)
Expand All @@ -22,7 +31,7 @@

for(i in 1:M) {
for(k in 1:K) {
eta[g,i,k] ~ dnorm(0, 1 / (sigma_ind * sigma_ind))
eta[g,i,k] ~ dnorm(0, 1 / (sigma_ind[g] * sigma_ind[g]))
} # i
} # k

Expand All @@ -34,9 +43,6 @@
for(i in 1:M) {
alpha2[g, i] ~ dnorm(mu_a2, 1 / sd_a2 / sd_a2) # take out g here? Trap behavior universal b/w sites?
} # m
mu_a2 ~ dnorm(0, 0.01)
# sd_a2 ~ dt(0, pow(5, -2), 1)T(0, ) # half cauchy prior with scale = 5 (25?)
sd_a2 ~ dunif(0, 5)

for(i in 1:M) {
z[g, i] ~ dbern(psi[g])
Expand All @@ -47,27 +53,25 @@

for(k in 1:K) {
for(t in 1:2) {
logit(p0[g, i, j, k, t]) <- alpha0[t] + (alpha2[g, i] * C[i, k, g]) + eta[g, i, k] # alpha2*C to rep. global behav. response
} # i
logit(p0[g, i, j, k, t]) <- alpha0[g, t] + (alpha2[g, i] * C[i, k, g]) + eta[g, i, k] # alpha2*C to rep. global behav. response
} # t
} # k
} # j
} # k
} # t #### error?
} # i

for(i in 1:M) {
Sex[i] ~ dbern(psi.sex)
Sex2[i] <- Sex[i] + 1
for (j in 1:max_trap[g]) {
for (k in 1:K) {
y[g, i, j, k] ~ dbern(p[g, i, j, k])
p[g, i, j, k] <- z[i]*p0[g, i, j, k, Sex2[i]* exp(- alpha1[Sex2[i]] * d[g, i,j] * d[g, i,j])
y[i, j, k, g] ~ dbern(p[g, i, j, k])
p[g, i, j, k] <- z[g, i] * p0[g, i, j, k, Sex2[g, i]] * exp(- alpha1[g, Sex2[g, i]] * d[g, i,j] * d[g, i,j])
} # i
} # j
} # k

# Derived parameters
N[g] <- sum(z[ , g])
N[g] <- sum(z[g , ])
# N[g] <- inprod(z[1:M_allsites], sitedummy[ , t]) ## see panel 9.2
density[g] <- N[g] / (xlim[[g]][2] - xlim[[g]][1]) # divided distances by 100 so calculates turtles per 100 m of canal
density[g] <- N[g] / (xlim[g, 2] - xlim[g, 1]) # divided distances by 100 so calculates turtles per 100 m of canal

} # g
}
Expand Down
2 changes: 1 addition & 1 deletion Code/MultiSessionModel_NHedits.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ trap_locs[i, 1:max_trap[i]] <- trap_dist_list[[i]] / 100

xlim <- matrix(NA, 12, 2)
for(i in 1:12){
xlim[i, 1:2] <- c(min(trap_dist_list[[i]]), max(trap_dist_list[[i]]) + 50) / 100 # need to have buffer on each side without being negative. Just added 50 to the end for testing but will have to think through
xlim[i, 1:2] <- c(min(trap_dist_list[[i]]) - 400, max(trap_dist_list[[i]]) + 400) / 100 # need to have buffer on each side without being negative. Just added 50 to the end for testing but will have to think through
}


Expand Down
Binary file modified Data/.DS_Store
Binary file not shown.
130 changes: 83 additions & 47 deletions Haydt_Report.nb.html

Large diffs are not rendered by default.

0 comments on commit c4a5550

Please sign in to comment.