Binomial Probability Distribution, N=20, p=0.2

In[60]:=

RowBox[{RowBox[{p, =, 0.2}], ;}] q = 1 - p ; probability = Table[    Binomial[20, i] p^iq^(20 - i)       , {i, 0, 20}]

Out[62]=

RowBox[{{, RowBox[{0.0115292, ,, 0.0576461, ,, 0.136909, ,, 0.205364, ,, 0.218199, ,, 0.17456, ... , 1.30057*10^-8, ,, 7.65041*10^-10, ,, 3.18767*10^-11, ,, 8.38861*10^-13, ,, 1.04858*10^-14}], }}]

These values are the probability of getting exactly msuccesses in 20 trials, where the probability of success FormBox[RowBox[{p, =, 0.2}], TraditionalForm], for m=0,1,2,...,20.

In[58]:=

{probability, Range[0, 20]}//TableForm

Out[58]//TableForm=

0.0115292 0.0576461 0.136909 0.205364 0.218199 0.17456 0.1091 0.0545499 0.0221609 0.00738696 0.00203141 0.000461685 0.0000865659 0.0000133178 1.66473*10^-6 1.66473*10^-7 1.30057*10^-8 7.65041*10^-10 3.18767*10^-11 8.38861*10^-13 1.04858*10^-14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

And here are the cumulative probabilities, which you get by adding the numbers in the previous list from 0 up to i.  This gives the probability of 0 to m successes in 20 trials, again with FormBox[RowBox[{p, =, 0.2}], TraditionalForm].

In[40]:=

cumulative = Table[ Total[probability[[Range[i + 1]]]], {i, 0, 20}]

Out[40]=

RowBox[{{, RowBox[{0.0115292, ,, 0.0691753, ,, 0.206085, ,, 0.411449, ,, 0.629648, ,, 0.804208 ... 437, ,, 0.999898, ,, 0.999985, ,, 0.999998, ,, 1., ,, 1., ,, 1., ,, 1., ,, 1., ,, 1., ,, 1.}], }}]

In[82]:=

p1 = ListPlot[probability, PlotJoinedTrue, PlotStyleHue[.6]] ; p2 = ListPlot[c ... xesLabel {"m", "probability"}, PlotLabel->"N=20, p=0.2"]

[Graphics:../HTMLFiles/binomial_20.gif]

Out[84]=

⁃Graphics⁃


Created by Mathematica  (September 30, 2003)