It is known that X1, X2,...,Xn are random samples from the population X, where the probability of X taking 0 or 1 is equal, that is, $P(X=0)=P(X=1)=\frac{1}{2}$.
I want to find an approximation of $P\left(\sum_{i=1}^{100} X_{i} \leq 55\right)$ by means of the central limit theorem.
I use the following code to calculate this problem, but MMA keeps running and can't get the result:
NProbability[Sum[x[i], {i, 1, 100}] <= 55,
Table[x[i] \[Distributed]
EmpiricalDistribution[{0.5, 0.5} -> {0, 1.}], {i, 1, 100}]]
Is there any way to quickly find the approximate value of this problem?
Supplementary mathematical analysis process:
$$E\left(\sum_{i=1}^{100} X_{i}\right) X=100 E X=50 . \quad D\left(\sum_{i=1}^{100} X_{i}\right)=100 D X=25$$
$$\begin{aligned} &\text { According to the central limit theorem } \sum_{i=1}^{100} X_{i} \sim N(50,25)\\ &\therefore P\left\{\sum_{i=1}^{100} X_{i} \leq 55\right\}=P\left\{\frac{\sum_{i=1}^{100} X_{i}-55}{5} \leq \frac{55-50}{5}\right\}=\Phi(1) \end{aligned} $$
Count[Table[Total[RandomChoice[{0.5, 0.5} -> {0, 1}, 100]], 100000],
u_ /; u <= 55]/100000.
(*0.8655*)
Erf[1.]
(*0.84270079295*)
Probability[x <= 55, x \[Distributed] BinomialDistribution[100, 1/2]]
which gives precisely 68482723177360620218041365161 / 79228162514264337593543950336 or roughly 0.864373 . If you want to demonstrate convergence to the normal distribution, thenN@Probability[x <= 55 + .5, x \[Distributed] NormalDistribution[50, 5]]
- the .5 is a correction, and stddev of binomial is Sqrt[n (1 - p) p] and mean is np for n=100,p=1/2 $\endgroup$NProbability[Sum[x[i], {i, 1, 100}] <= 55, Table[x[i] \[Distributed] EmpiricalDistribution[{0.25, 0.5, 0.25} -> {0, 1., 2.}], {i, 1, 100}]]
, what should you do? $\endgroup$NProbability[Total[Array[x, 100]] <= 55, # \[Distributed] dist & /@ Array[x, 100]]
will not complete for 100, but at that level I would just assume an almost-normal distribution anyway and use the limiting distribution:distapprox=NormalDistribution[Mean[dist]*100,StandardDeviation[dist]*Sqrt[100]]
thenProbability[x<=55+0.5,x \[Distributed] distapprox]]
which gives 1.55443*10^-10 - and that low probability makes sense becauseTotal@RandomVariate[dist, 100]
is normally very close to 100. $\endgroup$d2 = TransformedDistribution[ Total[Array[x, 100]], # \[Distributed] dist & /@ Array[x, 100]];
and getmu = Mean[d2]
andsd = StandardDeviation[d2]
then just plug mu*100 and sd*Sqrt[100] into NormalDistribution later. $\endgroup$