N-mixture model: Negative Binomial distribution for observation model

38 views
Skip to first unread message

Nguvan Agaigbe

unread,
Jul 1, 2024, 3:58:14 PMJul 1
to hmec...@googlegroups.com

Dear all,

I am a first-year PhD student in the process of building an IPM using count, productivity, and capture-recapture data sets spanning 11 years, and I am currently working on the population. model. The count data was collected by visiting the point survey locations once every year. I have been using the Michael Schaub and Marc Ke´ry textbook on IPM to learn about the IPMs and it has been very helpful. 

I have a couple of questions regarding my count data and the specification of the population model, especially the observation model in JAGS.
 
1. Since my count data does not have replicated counts (i.e., each point survey site was visited only once per year), is it appropriate to use N-mixture models for my population model? I am of the understanding that N-mixture models are mostly used for replicated counts and it appears I only have spatial replicates with one-time visitation per point site location. Should I consider a different model entirely? 
2. My count data follows a negative binomial distribution which means my observation model needs to be specified to follow a negative binomial, however, I am unable to specify the observation model correctly. The output I have from my analysis is giving me weird credible intervals with a range starting from 0.000.

I am hoping someone on this mailing list could provide guidance about what to do with the kind of count data I have and also take a look at my code and help me identify what I have done wrong and how I could get it right. Also, I am open to suggestions on resources I could use to successfully build my IPM, especially when counts follow a negative binomial distribution. 

Below is the code snippet for my model specification: I am not entirely sure if what I have done is correct. 

cat(file = "model2.txt", "
model {
  # Priors and linear models :Vague priors
  r ~ dgamma(1, 0.1)  # Dispersion parameter for negative binomial
  gamma ~ dunif(0, 10)  # Expected abundance in year 1
  phi ~ dunif(0, 1)  # Apparent survival (probability)
  rho ~ dunif(0, 1)  # Per-capita recruitment rate
  p ~ dunif(0, 1)  # Success probability

  # Population dynamics model
  for (i in 1:nsite) {
    N[i,1] ~ dpois(gamma)  # Initial population size with Poisson prior

    for (t in 2:nyear) {
      S[i,t] ~ dbinom(phi, N[i,t-1])  # Survivors
      R[i,t] ~ dpois(N[i,t-1] * rho)  # Recruits
      N[i,t] <- S[i,t] + R[i,t]  # Population size at time t (i.e Abundance)
    }
  }
  # Observation process
for (i in 1:nsite) {
    for (t in 1:nyear) {
    C[i,t] ~ dnegbin(p, r)  # Negative binomial observation model
    }
  }

# Derived quantities
for (t in 1:nyear) {
  ntot[t] <- sum(N[,t])  # Total abundance across all sites at time t
}
}
")


Thanks,

Nguvan.
 

John Clare

unread,
Jul 1, 2024, 4:19:38 PMJul 1
to Nguvan Agaigbe, hmec...@googlegroups.com
Hi Nguvan,

I think the issue is that jags uses a traditional parameterization of p and r (probability of success, number of successes) rather than other parameterizations. If you want, for example, a parameterization based on a mean and variance, you could write something like:

p<-mu/sigsq
r<-mu^2/(sigsq-mu)

and then put whatever priors on mu and sigsq. You can certainly parameterize it in terms of mean and dispersion, too, but I don’t remember that off the top of my head—might take a look at the AHM book (v1) or search around online.

John

On Jul 1, 2024, at 1:58 PM, Nguvan Agaigbe <agaigbe...@gmail.com> wrote:


--
*** 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 on the web visit https://groups.google.com/d/msgid/hmecology/CAMoqN5DDa%2BPTgSxe4_2z5CPqtoFRiZYgumDQhC1kii-K%3DgQ6Ww%40mail.gmail.com.

Marc Kery

unread,
Jul 1, 2024, 5:02:47 PMJul 1
to Nguvan Agaigbe, John Clare, hmec...@googlegroups.com
Dear Nguvan, John,

here's a relevant bit from the AHM1. (The link below is no longer functional though.)

Best regards  --- Marc









From: 'John Clare' via hmecology: Hierarchical Modeling in Ecology <hmec...@googlegroups.com>
Sent: Monday, July 1, 2024 22:19
To: Nguvan Agaigbe <agaigbe...@gmail.com>
Cc: hmec...@googlegroups.com <hmec...@googlegroups.com>
Subject: Re: N-mixture model: Negative Binomial distribution for observation model
 

Jeffrey Royle

unread,
Jul 1, 2024, 5:46:20 PMJul 1
to Nguvan Agaigbe, hmec...@googlegroups.com
Dear Nguvan
 I think you want to use a binomial model for your counts which is conditional on N , i.e., C[i] ~ dbin(p, N[i]) or similar -- presumably N is a shared parameter between the different data types and , also, the binomial model is consistent with the N-mixture model formulation. But I think it's important to think about whether the count data are providing any information if there is only 1 replicate and if the 'p' parameter of the binomial distribution is different than the p parameter of the capture-recapture data. (and note: I don't see the capture-recapture data model specified in the JAGS code you provided).  
 There are a couple examples in the AHM2 book too (10.7 and 10.8) that involve counts and CR data.
regards
andy




--

Nguvan Agaigbe

unread,
Jul 6, 2024, 9:09:51 PMJul 6
to Jeffrey Royle, hmec...@googlegroups.com
Thank you all for your responses. I now have a better understanding of the reparametrization when it comes to negative binomials in JAGS. 

My observed counts are overdispersed and that's the reason why I felt using a dnegbin will be appropriate. Please, is this a correct approach? 

There is spatial replication in the data, i.e., I have multiple survey points withing the study area, but each point was visited only once for the count observation. Will this survey protocol still not provide any information? 

Yes, the capture-recapture data model was not specified in the code provided because I’m trying to have the likelihood of individual data sets working separately before I integrate and the code was only for the population model. 


Nguvan. 
Reply all
Reply to author
Forward
0 new messages