# Estimating $n$ and $p$ for Binomial distribution, repeated counting of partly hidden population

A brief motivation: $n$ critters live in an aquarium, where sadly they often hide in, under or behind things. When the aquarium is observed, each critter is only seen with probability $p$ (independently), so the number of critters spotted is $X\sim \operatorname{Bin}(n,p)$. The observer takes repeated counts $X_1, X_2, ... , X_k$. Assume the time interval between counts is long enough that the critters have had time to rearrange themselves, so that $X_i$ and $X_{i+1}$ may be regarded as independent, but not so long that critters are born or die, so that $n$ is fixed.

A first issue - I'll call it case (i) - is how $n$ and $p$ might be estimated solely from the vector of observations $(x_1, ..., x_k)$. That's basically this question here. There are method-of-moments and maximum likelihood estimators available. Neither seems good! How could a Bayesian estimation proceed without additional information, is there any sensible prior for $n$?

A more interesting, and practical, scenario provides a sort of "anchor" for $n$. Suppose in case (ii) that a while before the observations were made, it was known there were $n_0$ critters, though there may have been births or deaths since. In the absence of any observations, in some sense $n_0$ remains the "best guess" for $n$. Once observations $x_i$ are available, this guess can be updated to reflect new information. This sounds more amenable to a Bayesian approach. Is there a good choice of prior? On the other hand I can't see how knowledge of $n_0$ would affect classical estimates of $n$ - not least because I haven't specified the relationship between $n_0$ and $n$. (It's unrealistic for the observer to know much more than that $n$ is likely near $n_0$.)

Now consider case (iii), where critters may die but can't give birth in captivity. The fact there were $n_0$ critters in the past now provides an upper bound on $n$. An obvious non-informative prior for $n$ has probability $\frac{1}{n_0}$ for $n = 1, 2, ..., n_0$ and zero otherwise; perhaps another prior is more useful, but the constraint $n \leq n_0$ means it should look different to case (ii). For classical estimation, the likelihood of $n$ above $n_0$ is zero, so clearly MLE calculations proceed differently. Maybe other estimators can give absurd results with $\hat{n} > n_0$ - could their performance be improved by capping them at $n_0$?

I hope the three cases are similar enough to bring together as a single question. In all three, a rough-and-ready $\hat{n}$ would be the maximum observation $x_i$, an approach that would be reasonably successful, albeit downwardly biased (it can't be an overestimate), if the sample size $k$ were large, and particularly if the probability $p$ of a critter being seen was near 1. But case (iii) is distinctive in that, if $x_i = n_0$ for any $i$, we can conclude with certainty that $n$ is $n_0$. I'd be interested in any practical approach, classical or Bayesian, to estimating $n$ and $p$, how such an approach is adapted between the cases, and how well such approaches can be expected to perform. Intuitively they will all struggle when $p$ is low, for instance, but some quantification of that would be brilliant. I'm sure the scenario described here is a well-studied practical problem - features like the partially-observed population of unknown size remind me of the German tank problem - but I can't find a name or discussion of it.

How could a Bayesian estimation proceed without additional information, is there any sensible prior for $n$?

Your question is almost exactly the same question that Adrian Raftery answers in his paper "Inference for the Binomial $N$ parameter." Instead of aquariums, the author was looking at counts of animals in a wildlife preserve. He assesses this question from several different directions, comparing Bayesian estimates to some classical but ad hoc estimators.

Is there a good choice of prior?

How to select priors is a question that is far too broad for this forum, is somewhat subjective, and entirely depends on what kind of problem you're trying to solve, and what an acceptable prior means to you, for your problem. No one else can do your analysis for you.

For example, one might characterize priors as noninformative, weakly informative and strongly informative. Within each of these taxonomies, reasonable people may disagree about which specific prior fits in each category. And you might disagree about which of those three paradigms are most appropriate.

The more elaborate models sound like reasonable elaborations of the basic problem. Clearly, constraining the range of values to lie in some interval will dramatically change your inferences. Likewise will attempting to model deaths, especially if different species have different lifetimes and if there are inter-dependencies between different species.

There is something to be said for parsimony: estimating a model of baroque complexity from a single vector places an enormous demand on both your prior and your data collection. One must wonder how sensitive your results would be to small changes in the values of observed data.

• Firstly: many thanks for adding a Bayesian perspective and such a great link. I am going to have a more thorough read and play with some simulation. Aug 30, 2014 at 20:50
• As for subjectivity and tradeoffs for priors: I'm interested in exploring how different people address this. The scenario is real enough: my aquarium has both (ii) breeding and (iii) non-breeding critters. For $n_0$ I know how many I bought! Counting critters in someone else's aquarium is (i). My analysis is curious not serious - no big deal if I "choose a bad prior" - yet I can see an equivalent problem may be of vital importance to someone else. I wonder what assumptions they make, priors they consider - particularly for the baffling case (i) - and which tradeoffs lead to their final choice. Aug 30, 2014 at 21:52
• You'll want to look at the Bayesian literature that examines the sensitivity of inference to the choice of prior. Alternatively, you can just do your own sensitivity analysis, and work out what gives you reasonable results in the framework of your knowledge and data collection. I don't know of any work in this area for this specific problem, possibly because it's impossible to judge which is the "correct" answer.
– Sycorax
Aug 30, 2014 at 22:24
• Thanks, that gives me a good place to start. It's the thought process I'm interested in - I've never used Bayesian modeling professionally, and when they came up in exams the process was very artificial (often given the prior and data and asked to calculate the posterior for instance). So I grasp the mechanics more than the art! Sep 1, 2014 at 16:09