# maths questions about the German tank problem

humy
Science 12 Jul '15 10:47
1. 12 Jul '15 10:474 edits
I have been trying to understand one of the equations on this link below about the German tank problem but having problems with it:

https://en.wikipedia.org/wiki/German_tank_problem

Near the very top of that link just under “Examples”, it says

“Suppose an intelligence officer has spotted k = 4 tanks with serial numbers, 2, 6, 7, and 14, with the maximum observed serial number, m = 14. The unknown total number of tanks is called N.
...
...the Bayesian analysis below yields (primarily) a probability mass function for the number of tanks ...”

And it then gives the equation for the probability for that starting with:

“ Pr(N = n) = ...”

now, where it says the condition “if n < m “, it makes perfect sense to me because it says the probability is 0 which makes sense because you cannot have the actual total number of tanks being less than the observed number of tanks!

But, where it says the condition “if n >= m “, that is where I get confused because the equation it gives appears to me to consist of the product of two fractions with the first one being “ (k – 1)/k “. The problem I have with that is that k is supposed to be the number of observed tanks thus, if there was only one tank observed i.e. if k=1, that would mean the “(k – 1)” part of that will equal 0 and thus we have;

(k – 1)/k = 0/1 = 0

and that would mean, whatever the value of the second fraction is, the product of the two fractions is always going to be 0 (because anything multiplied by 0 is 0 ) thus, according to that equation if I read that right, the probability , for any n (when k=1 ) will always be 0, which is total nonsense! You cannot have the sum of the probabilities of an exhaustive list of mutually exclusive possibilities adding up to zero probability!
So I assume I have misread that equation? If so, how so? If not, how can it make any sense?

OK, lets just ignore that problem for a moment and just consider k values greater than 1 and look at the second fraction which I read to be the fraction consisting of the value of one binomial coefficient divided by the value of another binomial coefficient. Have I read that right?
If I read that right, each of the two binomial coefficients is expressed as a single vertical column which I cannot edit here so lets express the numerator (top half of the fraction ) one as:

C(m – 1, k – 1)

then, according the the equation shown on https://en.wikipedia.org/wiki/Binomial_coefficient , and if we let g = m – 1 and
h = k – 1, that numerator is equal to:

C(m – 1, k – 1) = C(g, h) = g!h!(g – h)!

and the denominator of that second fraction is:

C(n, k) = n!k!(n – k)!

so the whole equation for Pr(N = n) for when n >= m is:

Pr(N = n) = ( (k – 1)/k ) / ( ( g!h!(g – h)! ) / ( n!k!(n – k)! ) )
(if n >= m and we let let g = m – 1 and h = k – 1 )

Have I got that right? Because I made a java program for this and when I try and run an iteration to find the sum of all the probabilities for all possible n values with some k value for k >1, they appear to almost converge to 1 but appear to me to not quite be converging to a probability of 1 but rather appear to be converging to a probability very close to 1 but just under 1, which doesn't quite make sense. But, that said, because it doesn't appear to make sense for k=1 anyway (always giving a sum of probabilities of 0 for k=1 ) I assume that means I have somehow gone wrong before that, right?
2. AThousandYoung
West Coast Rioter
12 Jul '15 17:432 edits
now, where it says the condition “if n < m “, it makes perfect sense to me because it says the probability is 0 which makes sense because you cannot have the actual total number of tanks being less than the observed number of tanks!

m is the highest serial number seen, not the number of tanks seen. There is an assumption that none of the tanks have been destroyed, so if you see the number 14 on one of the tanks, then there must be at least 14 tanks. So, if n < m, then there are fewer tanks than serial numbers, which violates the assumption that there are at least as many tanks as serial numbers.

From the introduction of the wiki article:

The analyses illustrate the difference between frequentist inference and Bayesian inference.

Estimating the population maximum based on a single sample yields divergent results, while the estimation based on multiple samples is an instructive practical estimation question whose answer is simple but not obvious.

This isn't a perfect answer for you, but it does help show that maybe this equation has some unusual results when k=1.

EDIT - Perhaps the equation you are discussing is telling us the probability that any particular number of tanks is the maximum for example:

You see one tank with serial number 5. How many tanks are there of that type?

1? No, because then n=1, m=5, and n<m so probability = 0.

It's not 2, 3, or 4 by the same reasoning.

So there are at least 5 tanks. Are there exactly 5? Probably not. In fact, this model gives a 0 probability to the possibility that there are only 5 tanks of this model. There are certainly more. But how many more?

Are there 6? Well, this model gives a 0 probability for there being 6 tanks...

Are there 5,000? The model gives a 0 probability for there being 5,000...

That's because the model requires two serial numbers to compare. Without two such numbers, there is no way to guess at how many tanks there are by this method.

I think.
3. 12 Jul '15 19:0910 edits
Originally posted by AThousandYoung
now, where it says the condition “if n < m “, it makes perfect sense to me because it says the probability is 0 which makes sense because you cannot have the actual total number of tanks being less than the observed number of tanks!

m is the highest serial number seen, not the number of tanks seen. There is an assumption that none of the ta ...[text shortened]... such numbers, there is no way to guess at how many tanks there are by this method.

I think.
thanks for that. I somehow got a bit muddled there with the n<m bit.
I think you must surely be right (about when k=1 ) because that is the only way I can see it can possibly make any sense.

I think I have now have a theory of why make my computer program doesn't seem to converge exactly right for that equation providing k>1 (it is to do with the problem of accurately representing vary large factorials, I think ) but it still does converge at least roughly right but it still just outputs total nonsense for k=1 which appears to confirm your suspicions.

I find it odd though that they didn't say or make it clear that equation for Pr(N = n) only validly applies for k > 1 and is nonsense for k = 1.
Anyone: should I or someone edit that omitted fact into that link?
4. 19 Jul '15 21:4214 edits
I have just 2 more questions about what it says in that link:
https://en.wikipedia.org/wiki/German_tank_problem

Where it says:

"...
Derivation

The probability that the sample maximum equals m is (m – 1, k – 1)/(N, k) , where ( . . ) is the binomial coefficient.
..."
(note that the binomial coefficients are expressed as vertical columns on that website which cannot be edited here so I have made them horizontal here )

1, Does "the sample maximum" in this case simply mean the largest known observed tank serial number in the sample space?
(I think the answer should be yes but I only ask because I got a bit suspicious that they didn't clearly state this )

2, where does (m – 1, k – 1)/(N, k) come from?
I mean WHY does that probability Pr(m) equal (m – 1, k – 1)/(N, k) ?
(this is what I desperately want most to know )
I would also like to know in particular if it in any way comes from an application of the principle of indifference and/or the equation for posterior probability and, if so, how so.
5. 21 Jul '15 10:231 edit
Originally posted by humy
I have just 2 more questions about what it says in that link:
https://en.wikipedia.org/wiki/German_tank_problem

Where it says:

"...
Derivation

The probability that the sample maximum equals m is (m – 1, k – 1)/(N, k) , where ( . . ) is the binomial coefficient.
..."
(note that the binomial coefficients are expressed as vertical columns on that we ...[text shortened]... the principle of indifference and/or the equation for posterior probability and, if so, how so.
Wait! I think I have almost got it!
I was totally stumped and had totally given up in despair but now suddenly making hopeful progress so don't anyone tell me the answer until I have had another go at figuring it out for myself.
6. Soothfast
0,1,1,2,3,5,8,13,21,
22 Jul '15 05:301 edit
The solution to every German problem is actually quite simple: Was nicht passt, wird passend gemacht.

What doesn&#039;t fit will be made to fit, though sometimes translated as &quot;If it doesn&#039;t fit, get a bigger hammer.&quot;