Approximate Binomial distribution by Normal Distribution

Name : Rama Salami
Mini project

Manipulate[
BarCharts`BarChart[Table[PDF[BinomialDistribution[n,p],i], {i,0,40}],BarLabels->Range[0,40],PlotRange->{{0,20},{0,1}}, ImageSize->{500,300}], {{n,20,"number of trials n"}, 10,30,1,Appearance->"Labeled"}, {{p,.5,"probability of successses p"},0.05,0.95,Appearance->"Labeled"},Initialization:>{Get["BarCharts`"]}]

Description:   
  In probability theory and statistics, the binomial distribution is the discrete probability distribution of the number of successes in a sequence of n independent yes/no experiments, each of which yields success with probability p , failure with probability q(p=1-q),with n numbers of trials.
First, I am trying to get a general picture of the binomial distribution when we do it for number of trials (n), where (n<=30). We need n to be less or equal than thirty.
I used manipulate command and I chose bar chart of the table that includes the pdf (probability distribution function) for the binomial distribution with n number of trials and p probability of successes and (i) variable changes between zero and forty. I chose the x-axis to go from zero to thirty and my y-axis from zero to twenty.
Then I labeled my variables to be(n number of trials start from 10--30 by one),(and p number of successes from0.05--0.95 .
Finally,I got my first chart, which present the general graph for the binomial distribution and show p probability of successes p in number of trials n.

Manipulate[
With[{Maximum=Max[InverseCDF[BinomialDistribution[n, p],.950],InverseCDF[NormalDistribution[n*p, Sqrt[n*p*(1-p)]],.950]],
Minimum=Min[-.5,InverseCDF[NormalDistribution[n*p, Sqrt[n*p*(1-p)]],.001]]},Show[BarCharts`GeneralizedBarChart[Table[{i,PDF[BinomialDistribution[n, p],i],1}, {i,0,n}],
PlotRange->{{Minimum,Maximum},{0,.5}},
BarStyle->Directive[Blue,Opacity[0.5]]],
Plot[PDF[NormalDistribution[n*p, Sqrt[n*p*(1-p)]],x], {x,Minimum,Maximum}, 
PlotRange->{0,.5},
FillingStyle->Directive[Opacity[0.6]],
PlotStyle->{Orange, Thick}],
ImageSize->{500,350}]],   
{{n,30,"number of trials n"}, 20,60,1, Appearance->"Labeled"},
{{p,.5,"probability of successes p"}, 0.05,0.95 , Appearance->"Labeled"}]

In this chart I am trying to give an idea about what would happened if n (number of trials) for the binomial distribution becomes very large. Then by the central limit theorem, which implies that, for large values of n (n >= 30) a binomial random variable can be well approximated by a normal random variable with the same mean and variance. A measure of agreement between the two is obtained by computing the dark blue area (on my chart).
In this graph I am trying to prove that,  Therefore, I used the manipulate command with defining a function Maximum to be the maximum of the binomial distribution with value of (i=0.950) and also the normal for the same value (where the mean=np ,and the variance=Sqrt(n*p*q),same as Sqrt(n,p,1-p)),and then the second function called the Minimum to be the normal with the same mean and variance but now with a samller value for (i) (0.001) ,in this case I limited the binomial distribution by the normal distribution from both upper and lower sides.
Then I used the show command for the binomial distribution with i goes from 0 to n, with plot range goes from Minimum to Maximum , then I chose the bar style to be blue color, and then the plot style to be orange and thick(normal distribution),then I used the command showoverlab to see the over lab between the two distributions.
    Finally,my purpose in this project was to prove that for large number of trials of binomial distripution,we could use the normal distribution instead by the central  limit theorem.


.