Dear all,
I am currently running N-mixture models (Binomial/ Poisson; see code below) to estimate population size. However, the results seem unusual — the R-hat values are 0 for all sites with no detections (see below).
Could you please advise me on how to address this issue?
Many thanks,
Hoang
1. Code:
modeltext <- "
model{
                      for(i in 1:nSites){
                                  # Biological model Poisson distribution
                                  N[i] ~ dpois(lambda[i])
                                  log(lambda[i]) <- alpha.lam + 1 * logA[i] +
eps[i] Â # we used the log of the size of the sampling unit (logA) as an
additive offset
                                  eps[i] ~ dnorm(0, tau) # random effect
                     Â
                                  # Observation model: Binomial distribution
                                  for(j in 1:nOcc) {
                                              C[i,j] ~ dbin(p, N[i])
                                             Â
                                              # GOF
                                              FT.obs1[i,j] <- (sqrt(C[i,j]) - sqrt(lambda[i]
* p))^2
                                              C.sim[i,j] ~ dbin(p, N[i])
                                              FT.sim1[i,j] <- (sqrt(C.sim[i,j]) -
sqrt(lambda[i] * p))^2
                                  }        Â
                      }
                                 Â
                      # Priors
                      alpha.lam
~ dunif(-10, 10)
                      tau <- pow(sigma, -2)
                      sigma ~ dunif(0, 10)
                      #psi ~ dbeta(4.375, 5.625)
   # centered on 0.4375, naive occupation
                     p
~ dbeta(5.63, 4.37) Â Â Â Â Â # centered on 0.563,
naive average detection probablity Â
                     Â
          Â
                      #p ~ dbeta(1,1) # use a
uniform Beta(1,1) prior for the probability of detection P
                                 Â
                      # GOF
                      FT.obs
<- sum(FT.obs1)
                      FT.sim
<- sum(FT.sim1)
                                 Â
                      # derived variable
                      totalN <- sum(N[])                                                   #Estimate of total abundance across all sites
                      mean.abundance <-
mean(lambda[])Â #mean expected abundance per occupied
site
}"
Â
2. Results
MCMC values from jagsUI
object ‘jagsOut’
The object has 38 nodes with 3e+05 draws for each of 6 chains.
l95 and u95 are the limits of a 95% Highest Density Credible Interval.
Rhat is the estimated potential scale reduction factor:
    largest is 2.00; 1 (3%) are greater than 1.10; 20
(53%) are NA.
MCEpc is the Monte Carlo standard error as a percentage of the posterior SD:
    largest is 0.4%; NONE are greater than 5%.
         mean Â
 sd  median   l95   u95  Rhat MCEpc
totalN Â Â Â Â Â 40.107 8.291 Â 38.000 Â 28.000
 55.000 1.000 0.349
mean.abundance  1.254 0.326  1.207  0.700  1.893 1.000
0.290
p         0.460 0.082  0.463
 0.297  0.616 1.000 0.304
FT.obs      36.081 8.895  34.944  20.530
 53.968 1.000 0.353
FT.sim      37.766 8.074  36.889  23.309
 54.083 1.000 0.323
N[1] Â Â Â Â Â Â 0.036 0.202 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.144
N[2] Â Â Â Â Â Â 0.027 0.172 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.139
N[3] Â Â Â Â Â Â 0.041 0.215 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.143
N[4] Â Â Â Â Â Â 0.029 0.182 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.141
N[5] Â Â Â Â Â Â 0.034 0.195 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.139
N[6] Â Â Â Â Â Â 0.034 0.196 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.142
N[7] Â Â Â Â Â Â 0.037 0.205 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.146
N[8] Â Â Â Â Â Â 1.059 0.262 Â 1.000 Â
1.000 Â 2.000 Â Â NA 0.152
N[9] Â Â Â Â Â Â 0.035 0.198 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.141
N[10] Â Â Â Â Â Â 0.035 0.198 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.140
N[11] Â Â Â Â Â Â 0.035 0.197 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.146
N[12] Â Â Â Â Â Â 0.033 0.194 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.145
N[13] Â Â Â Â Â Â 1.104 0.355 Â 1.000 Â
1.000 Â 2.000 Â Â NA 0.160
N[14] Â Â Â Â Â Â 2.297 0.634 Â 2.000 Â
2.000 Â 4.000 1.000 0.186
N[15] Â Â Â Â Â Â 0.033 0.193 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.145
N[16] Â Â Â Â Â Â 0.036 0.201 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.140
N[17] Â Â Â Â Â Â 1.116 0.377 Â 1.000 Â
1.000 Â 2.000 2.000 0.158
N[18] Â Â Â Â Â Â 2.496 0.835 Â 2.000 Â
2.000 Â 4.000 1.091 0.225
N[19] Â Â Â Â Â Â 0.021 0.150 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.138
N[20] Â Â Â Â Â Â 1.210 0.516 Â 1.000 Â
1.000 Â 2.000 1.000 0.175
N[21] Â Â Â Â Â Â 1.390 0.709 Â 1.000 Â
1.000 Â 3.000 1.000 0.194
N[22] Â Â Â Â Â Â 0.028 0.176 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.142
N[23] Â Â Â Â Â Â 0.029 0.179 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.138
N[24] Â Â Â Â Â Â 1.197 0.500 Â 1.000 Â
1.000 Â 2.000 1.000 0.172
N[25] Â Â Â Â Â Â 3.663 1.017 Â 3.000 Â
3.000 Â 6.000 1.000 0.227
N[26] Â Â Â Â Â Â 4.981 1.697 Â 5.000 Â
3.000 Â 8.000 1.000 0.265
N[27] Â Â Â Â Â Â 6.709 2.114 Â 6.000 Â
4.000 Â 11.000 1.000 0.275
N[28] Â Â Â Â Â Â 0.028 0.179 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.148
N[29] Â Â Â Â Â Â 3.751 1.467 Â 3.000 Â
2.000 Â 6.000 1.000 0.255
N[30] Â Â Â Â Â Â 2.599 0.938 Â 2.000 Â
2.000 Â 4.000 1.000 0.219
N[31] Â Â Â Â Â Â 5.955 1.810 Â 6.000 Â
4.000 Â 9.000 1.000 0.264
N[32] Â Â Â Â Â Â 0.030 0.184 Â 0.000 Â
0.000 Â 0.000 Â Â NA 0.140
deviance    119.980 6.483 119.037 109.240 132.597 1.000 0.223
#Posterior predictive check
plot
pp.check(jagsOut, observed = 'FT.obs', simulated = 'FT.sim')
# P-value = 0.64
DIC(jagsOut)
# DIC = Â 141.00
Â
--
*** Three hierarchical modeling email lists ***
(1) unmarked: for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology (this list): for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2016, 2021) and Schaub & Kéry (2022)
---
You received this message because you are subscribed to the Google Groups "hmecology: Hierarchical Modeling in Ecology" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hmecology/3b0f2985-a486-4693-a79d-e00e9898bc53n%40googlegroups.com.
Hi,
The issue with NA values has been resolved by using the MCMCvis package instead of mcmcOutput.
However, I’m facing another problem: although all R-hat values are equal to 1, the trace plots (attached) do not indicate good convergence—they show noticeable spikes.
Could you please advise what might be causing this issue and how I could address it?
Thank you very much,
Hoang
Hi,
The issue with NA values has been resolved by using the MCMCvis package instead of mcmcOutput.
However, I’m facing another problem: although all R-hat values are equal to 1, the trace plots (attached) do not indicate good convergence—they show noticeable spikes.
Could you please advise what might be causing this issue and how I could address it?
Thank you very much,
Hoang