# BRugs model for mark-recovery, based on a binomial distribution

model{
  # Data come from the file MRdata.txt (example shown below)
  
  # M <- 100               # number of marked fish
  # S <- 500               # number of fish sampled
  # R <- 5                 # number of marks recaptured
  # eps <- 0.001           # small number for prior
  
  # Model for R with unknown p=M/N
  R ~ dbin(p,S)            # binomial distribution
  N <- M/p                 # because p = M/N
  
  # prior for p = M/N (approximately R/S)
  p1 <- eps * R/S
  p2 <- 1 - p1
  p ~ dunif(p1,p2) }       # uniform distribution
