Suppose $X$ is a discrete random variable such that $X$~$B(100,0.028)$.
What would be the fastest way to calculate something along the lines of: $P$ { $2 \le X \le 6 $ } ?
Suppose $X$ is a discrete random variable such that $X$~$B(100,0.028)$.
What would be the fastest way to calculate something along the lines of: $P$ { $2 \le X \le 6 $ } ?
On
As far as I know, if $X\sim \mathcal{B}(n,p)$, then it can be approached by the Gaussian distribution $\mathcal{N}\big(np,np(1-p)\big)$, as long as $\mathbf{n\ge 30}$ and $\mathbf{np \ge 5}$, which can give us a fairly good approximation. In that case, we have: $$\Pr(a\le X\le b)\approx \Pr\left(\frac{a - np}{\sqrt{np(1-np)}}\le Z = \frac{X-\mu}{\sigma} \le \frac{b-np}{\sqrt{np(1-p)}}\right),$$ where $\mu = np, \sigma = \sqrt{np(1-p)}$ and $Z \sim \mathcal{N}(0,1)$. In that specific situation we have that $n = 100$ and $p = 0.028$, which implies $np = 2.8$. So, I don't know if that approach would be good enough.
Following the normal procedure, we have (with the help of Mathematica): $$\textbf{prob_1}=\Pr(2\le X\le 6) = \sum_{k = 2}^{6}\binom{100}k\cdot 0.028^k \cdot (1-0.028)^{100-k}=\boxed{0.750672}. $$
Considering the approach by the Gaussian distribution (which is a lot faster in some way), we have:
$$\textbf{prob_2} = \Pr(-0.484929\le Z \le 1.93971) \begin{array}[t]{l} =\Phi(1.93971) - \Phi(-0.484929) \\ =\Phi(1.93971) + \Phi(0.484929)-1 \\ = \boxed{0.65993}. \end{array}$$
As long as $n\ge 30$ and $np\gg 5$, then $\left| \textbf{prob_1} - \textbf{prob_2} \right| \to 0$.
This would be the fastest. $$ P(2 \leq X\leq 6) = P(X\leq 6) - P(X<2) $$ so this would be $$ P(X=2) + P(X=3) + P(X=4) + P(X=5) + P(X=6) $$