I am in need of variance of doubly truncated binomial distribution (equation number 3.69 on page number 137 of third edition of Johnson, Kemp and Kotz Discrete Probability Distributions).
Thanks. Anwer
Let $X \sim \text{Binomial}(n,p)$ with pmf $f(x)$:
Let $a$ and $b$ denote the lower and upper points of truncation, such that $a \leq X \leq b$.
Then, $P(a \leq X \leq b)$ is:
where I am using the Prob
function from the mathStatica package for Mathematica to do the nitty-gritties.
Then, the pmf of the doubly truncated random variable $X$ s.t. $a \leq X \leq b$, with pmf denoted $g(x)$, is:
Finally, we seek $\text{Var}_g(X)$:
All done. The solution output can be viewed LARGER here:
http://www.tri.org.au/se/varianceofdoublytruncatedBinomial.png
Quick Plot
Just to make sure the result makes sense, here is a quick plot of the solution just derived -- the variance of the doubly truncated Binomial -- when $n = 12, p = \frac34, b= 12$, as the lower bound $a$ increases from 0 to 12. The thin red horizontal line is the unconditional variance of the Binomial parent (i.e. $np(1-p)$ ), and the the blue dots are the variance of the doubly truncated model, as the lower bound $a$ increases. As one would expect, the variance of the bounded model should be smaller than the unconstrained model. All looks fine.
Notes
The Prob
and Var
function used above are from the mathStatica package for Mathematica.
The variance calculation took about 10 hours to compute on a 2014 R2-D2 Mac Pro, though much of this would have been 'simplification' time.
Details on the Hypergeometric2F1
etc functions can be found here: http://reference.wolfram.com/language/ref/Hypergeometric2F1.html
FullSimplify
. Under Mma 9, the total time is 15 minutes. Under Mma 10, the same calculation took 10 hours - aha (running overnight). There does seem to be some bug or problem with FullSimplify
under the new Mma 10.
$\endgroup$