Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My cousin is at elementary school and every week is given a book by his teacher. He then reads it and returns it in time to get another one the next week. After a while we started noticing that he was getting books he had read before and this became gradually more common over time. Naturally, I started to wonder how one could estimate the total number of books in their library.

Say the true number of books in the library is $N$ and the teacher picks one uniformly at random (with replacement) to give to you each week. If at week $t$ you have received a book you have read before on $x$ occasions, then I can produce a maximum likelihood estimate for the number of books in the library following How many books are in a library? .

Clarification. If the books he receives are named $A,B,C,B, A, D$ then $x$ will be $0,0,0,1,2,2$ at successive weeks.

However, is there a mathematical formula as a function of $t$ and $x$ which will give me a 95% confidence interval for this estimate?

share|cite|improve this question
How about the number of students? That should be important too, because if there are more students more books are checked out. – Alt Feb 5 '14 at 22:16
Well yes but let's assume only my cousin gets books for the moment. I still don't know how to solve that simplified version. – Anush Feb 5 '14 at 22:26
up vote 5 down vote accepted

I'll use the framework of the library book problem. Let $K$ be the total sample size, $N$ be the number of different items observed, $N_1$ be the number of items seen once, $N_2$ be the number of items seen twice, $A=N_1(1-{N_1 \over K})+2N_2,$ and $\hat Q = {N_1 \over K}.$

Then an approximate 95% confidence interval on the total population size $M$ is given by

$$\hat M_{Lower}={1 \over {1-\hat Q+{1.96 \sqrt{A} \over K} }} $$

$$\hat M_{Upper}={1 \over {1-\hat Q-{1.96 \sqrt{A} \over K} }} $$

As noted in the discussion of the library problem, at times the upper bound will be infinite, especially for small samples. Similarly, the lower bound may need to be capped at zero.

This approach is due to Good and Turing. A reference with the confidence interval is Esty, The Annals of Statistics, 1983.

share|cite|improve this answer
Could you explain or how you derived $A$ and $\hat {Q}$ – user92612 Jun 6 '15 at 22:22
The reference is publicly available through Project Euclid. – soakley Jun 7 '15 at 0:51
Thanks for the reference. Are you aware of any estimates that do not assume uniform probability? – user92612 Jun 7 '15 at 15:23
No, I don't know of any. – soakley Jun 7 '15 at 20:41

Yes and no. An EXACT confidence interval would be best approximated via simulation. However, you can get an approximate 95% CI using Wilks likelihodd ratio statistic on the sample likelihood function. This assumes that the likelihood function value of the true value (normalized so that the maximum value is 1) follows a chi-square distribution, so you can get a specified value of the likelihood to use as as cutoff.

share|cite|improve this answer
I would be happy with something approximate. How exactly can I do this for my problem? – Anush Jan 30 '14 at 8:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.