##### Page tree
Go to start of banner

# Bayesian analysis example: Tigers in the jungle

 A game warden on an island covered in jungle would like to know how many tigers she has on her island. It is a big island with dense jungle and she has a limited budget, so she can't search every inch of the island methodically. Besides, she wants to disturb the tigers and the other fauna as little as possible. She arranges for a capture-release-recapture survey to be carried out as follows: Hidden traps are laid at random points on the island. The traps are furnished with transmitters that signal a catch and each captured tiger is retrieved immediately. When 20 tigers have been caught, the traps are removed. Each of these 20 tigers are carefully sedated and marked with an ear tag, then all are released together back to the positions they were originally caught. Some short time later, hidden traps are laid again, but at different points on the island until 30 tigers have been caught and the number of tagged tigers is recorded. Captured tigers are held in captivity until the 30th tiger has been caught. The experiment results in 7 out of the 30 tigers captured in the second set of traps are tagged. How many tigers are there on the island?

The warden has gone to some lengths to specify the experiment precisely. This is so that we will be able to assume within reasonable accuracy that the experiment is taking a hypergeometric sample from the tiger population. A hypergeometric sample assumes that an individual with the characteristic of interest (in this case, a tagged tiger) has the same probability of being sampled as any individual that does not have that characteristic (i.e. the untagged tigers). You might enjoy thinking through what assumptions are being made in this analysis and where the experimental design has attempted to minimize any deviation from a true hypergeometric sampling.

We will use the usual notation for a hypergeometric process:

n - the sample size, = 30,

D - the number of individuals in the population of interest (tagged tigers) = 20,

M - the population (the number of tigers in the jungle). In the Bayesian inference terminology, this is given the symbol q as it is the parameter we are attempting to estimate, and

s - the number of individuals in the sample that have the characteristic of interest = 7.

We could get a best guess for M by noting that the most likely scenario would be for us to see tagged tigers in the sample in the same proportion as they occur in the population. In other words:

$\frac{s}{n} \approx \frac{D}{M}$             i.e.           $\frac{7}{30} \approx \frac{20}{M}$ which gives M » 85 to 86

but this does not take account of the uncertainty that occurs due to the random sampling involved in the experiment. Let us imagine that before the experiment was started the warden and her staff believed that the number of tigers was equally likely to be any one value as any other. In other words, they knew absolutely nothing about the number of tigers in the jungle and their prior distribution is thus a discrete uniform distribution over all non-negative integers. This is rather unlikely, of course, but we will discuss better prior distributions elsewhere.

The likelihood function is given by the probability mass function of the hypergeometric distribution, i.e.:

$l(X|\theta)=\frac{\bigl(\begin{smallmatrix} D \\ s \end{smallmatrix} \bigr) \bigl(\begin{smallmatrix} M-D \\ n-s \end{smallmatrix} \bigr)}{\bigl(\begin{smallmatrix} M \\ n \end{smallmatrix} \bigr)} =\frac{\bigl(\begin{smallmatrix} 20 \\ 7 \end{smallmatrix} \bigr) \bigl(\begin{smallmatrix} \theta -20 \\ 23 \end{smallmatrix} \bigr)}{\bigl(\begin{smallmatrix} \theta \\ 30 \end{smallmatrix} \bigr)}$   $\theta \geq 43$

$l(X|\theta)=0$

otherwise

The likelihood function is zero for values of q below 43 since the experiment tells us that there must be at least 43 tigers: 20 that were tagged plus the (30-7) that were caught in the recapture part of the experiment and were not tagged.

The Tigers model performs the Bayesian estimate where a discrete uniform prior, with values of q running from 0 to 150 is multiplied by the likelihood function above to arrive at a posterior distribution.

The links to the Tigers software specific models are provided here:

Crystal Ball

Note that Excel provides a convenient function HYPGEOMDIST(s, n, D, M) which will calculate the hypergeometric distribution mass function automatically.

Tigers model formulae:

q = tested value for total tigers M

p(q) = 1

l(X|q) =IF(q<n+D-s,0,HYPGEOMDIST(s,n,D,q))

The shape of this posterior distribution is shown in Figure 1.

Figure 1: Posterior distribution for q = [0,150]

The graph peaks at a value of 85 as we would expect but it appears cut off at the right tail which shows that we should also look at values of q larger than 150. The analysis is extended for values of q up to 300 with the same shaped prior and this more complete posterior distribution plotted in Figure 2.

Figure 2: Posterior distribution for q = [0,300]

This second plot represents a good model of the state of the warden's knowledge about the number of tigers on that island. Don't forget that this is a distribution of belief and is not a true probability distribution since there is an exact number of tigers on that island.

In this example, we had to adjust our range of tested values of q in light of the posterior distribution. It is quite common to review the set of tested values of q, either expanding the prior's range or modeling some part of the prior's range in more detail when the posterior distribution is concentrated around a small range. It is entirely appropriate to expand the range of the prior as long as we would have been happy to have extended our prior to the new range before seeing the data, and as long as we continue the same shape. However, it would not be appropriate if we had a much more informed prior belief that gave an absolute range for the uncertain parameter that we are now considering stepping outside of. This would not be right because we would be revising our prior belief in light of the data which would be double-counting the data. However, if the likelihood function is concentrated very much at one end of the range of the prior, it may well be worth reviewing whether the prior distribution or the likelihood function are appropriate.

Continuing with our tigers on an island, let us imagine that the warden is unsatisfied with the level of uncertainty that remains about the number of tigers which, from 50 to 250, is rather large. She releases all the tigers, decides to wait a short while and then recaptures another 30 tigers. The experiment is completed and this time t tagged tigers are captured. Assuming that a tagged tiger still has the same probability of being captured as an untagged tiger, what is her uncertainty distribution now for the number of tigers on the island?

This is simply a replication of the first problem, except that we no longer use a discrete uniform distribution as her prior. Instead, the distribution of Figure 2 represents her prior belief and the likelihood function is now given by the Excel function HYPGEOMDIST(t, 30, 20, q). The six panels of Figure 3 show what the warden's posterior distribution would have been if the second experiment had trapped t = 1, 3, 5, 7, 10 and 15 tagged tigers instead.

Figure 3: Change in posterior distribution of Tiger estimate
depending on the number of tagged tigers seen in the second sample

You might initially imagine that performing another experiment would make you more confident about the actual number of tigers on the island, but the graphs of Figure 3 show that this is not necessarily so. In the top two panels the posterior distribution is now more spread that the prior because the data contradicts the prior (the prior and likelihood peak at very different values of q). In the middle left panel, the likelihood disagrees moderately with the prior but the extra information in the data compensates for this, leaving us with about the same level of uncertainty but with a posterior distribution that is to the right of the prior. The middle right panel represents the scenario where the second experiment has the same results as the first. Since both experiments produced the same result, our confidence is improved and remains centered around the best guess of 85. In the bottom two panels, the likelihood functions disagree with the priors, yet the posterior distributions have a narrower uncertainty. This is because the likelihood function is placing emphasis on the left tail of the possible range of values for q, which is bounded at q = 43.

@Risk

Note that Excel provides a convenient function HYPGEOMDIST(s, n, D, M) which will calculate the hypergeometric distribution mass function automatically.

We know that the total confidence must add up to one which is done in column F to produce the normalized posterior distribution. The shape of this posterior distribution is shown below by plotting column B against column F from the spreadsheet.

The graph peaks at a value of 85 as we would expect but it appears cut off at the right tail which shows that we should also look at values of q larger than 150. The analysis is repeated for values of q up to 300 and this more complete posterior distribution plotted below:

This second plot represents a good model of the state of the warden’s knowledge about the number of tigers on that island. Don’t forget that this is a distribution of belief and is not a true probability distribution since there is an exact number of tigers on that island.

In this example, we had to adjust our range of tested values of q in light of the posterior distribution. It is quite common to review the set of tested values of q, either expanding the prior’s range or modeling some part of the prior’s range in more detail when the posterior distribution is concentrated around a small range. It is entirely appropriate to expand the range of the prior as long as we would have been happy to have extended our prior to the new range before seeing the data. However, it would not be appropriate if we had a much more informed prior belief that gave an absolute range for the uncertain parameter that we are now considering stepping outside of. This would not be right because we would be revising our prior belief in light of the data: putting the cart before the horse, if you like. However, if the likelihood function is concentrated very much at one end of the range of the prior, it may well be worth reviewing whether the prior distribution or the likelihood function are appropriate, since the analysis could be suggesting that the true value of the parameter lies outside the preconceived range of the prior.

Continuing with our tigers on an island, let us imagine that the warden is unsatisfied with the level of uncertainty that remains about the number of tigers which, from 50 to 250, is rather large. She decides to wait a short while and then capture another 30 tigers. The experiment is completed and this time ttagged tigers are captured. Assuming that a tagged tiger still has the same probability of being captured as an untagged tiger, what is her uncertainty distribution now for the number of tigers on the island?

This is simply a replication of the first problem, except that we no longer use a discrete uniform distribution as her prior. Instead, the distribution plotted above represents the state of her knowledge prior to doing this second experiment and the likelihood function is now given by the Excel function HYPGEOMDIST(t, 30, 20, q). The six panels below show what the warden’s posterior distribution would have been if the second experiment had trapped t = 1, 3, 5, 7, 10 and 15 tagged tigers instead. These posteriors (in black) are plotted together with the prior (in blue) and the likelihood functions (in red), all normalized to sum to 1 for ease of comparison.

You might initially imagine that performing another experiment would make you more confident about the actual number of tigers on the island, but the graphs show that this is not necessarily so. The posterior distributions for the two panels below are now more spread than the prior because the data contradicts the prior (the prior and likelihood peak at very different values of q).

In the case of 5 tigers, the data disagree moderately with the prior but the extra information in the data compensates for this, leaving us with about the same level of uncertainty but with a posterior distribution that is to the right of the prior.

The  right panel below (example with 7 tigers) represents the scenario where the second experiment has the same results as the first. You’ll see that the prior and likelihood overlay on each other because the prior of the first experiment was uniform and therefore the posterior shape was only influenced by the likelihood function. Since both experiments produced the same result, our confidence is improved and remains centered around the best guess of 85:

In the last panels below, the likelihood functions disagree with the priors, yet the posterior distributions have a narrower uncertainty. This is because the likelihood function is placing emphasis on the left tail of the possible range of values for q, which is bounded at q = 43:

In summary, these six panels show that the amount of information contained in data is dependent on two things: (1) the manner in which the data were collected (i.e. the level of randomness inherent in the collection), which is described by the likelihood function, and (2) the state of our knowledge prior to observing the data and the degree to which it compares with the likelihood function. If the data tell us what we are already fairly sure of, there is little information contained in the data for us (though the data would contain much more information for those more ignorant of the parameter). On the other hand, if the data contradict what we already know, our uncertainty may either reduce or increase depending on the circumstances. Thus, you could consider that the amount of information in a data set can be measured by the degree to which our opinion changes. Alternatively, taking a more decision-focused view, there is only information in data if it changes what we would chose to do in managing the risk issue.

• No labels