Print

Print


I am trying to use Winbugs to estimate the size of the population using
capture-recapture methodology. As an example, I am using AT&T switch data
taken from Sanjib Basu's article. (for reference of the likelihood
function for capture-recapture, Biometrika(2001) 88, 1, p.269-279):

# J=6 is the number of reviewers
# n[j] is the number of errors found by reviewer j
# m[j] is the number of errors previously found
# r=43 is the number of errors found by at least one reviewer (distinct
errors)

Suppose there is heterogeneity among reviewers, the likelihood function
for N and p can be written as a product of (N choose r) and the product(
from j=1 to 6) of pow(p[j],n[j])*pow(1-p[j], N-n[j])
with priors for p and N as:
p[j]~ dbeta(k*g, k*(1-g)
N~dunif(1, Nmax)

In winbugs:

model

{
# prior distribution

N~dunif(1, Nmax)
r<-sum(n[])-sum(m[])
for (j in 1:6)
{ p[j]~dbeta(a,b)
}
a<-k*g
b<-k*(1-g)
M1<-exp(logfact(N)-(logfact(r)+logfact(N-r)))

# Likelihood function
for ( j in 1:6) {
ones[j]<-1
ones[j]~dbern(prop[j])
Lk[j]<-M1*pow(p[j], n[j])*pow(1-p[j], N-n[j])
prop[j]<-Lk[j]/big.K
}
big.K<-100
}

data:
list(n=c(25, 3, 4, 13, 9, 6), m=c(0, 1, 0, 9, 3, 4),  Nmax=400,k=2, g=0.2)

Init:
list(N=50 p=c(0.2, 0.2, 0.2, 0.2, 0.2, 0.2))

Basu's result: N-hat=65

This program works, but the result is incorrect. Did I make a mistake in
defining the likelihood function, (Lk[j])?

I've been trying to figure this out for few days, and I have a feeling
that this is very simple. I just don't get it. I hope someone out there
can help me.

-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]

To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.

To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list