Workshop:  Binomial Distribution

STUDENT NAME:

Problem #1:  A drunk takes a total of Num=5 and suppose the probability of a step to the right p=0.5  is the same as the probability q of a step to the left.  Remember p+q=1 and so since q=1-p  it follows that q=0.5ω

The Binomial distribution W[nR] is defined using

Num = 5;
p = 0.5;
q = 0.5; 
W[nR_] :=  ((Num!)/(nR! (Num - nR)!))  (p^nR)   (q^(Num - nR))

Compute W[nR] for the values of nR between 0 and 5 and fill in the table below.  The first column are the values of nR and the second column are the values of the corresponding W[nR].

data=({{0, 0.03125}, {1, \[Placeholder]}, {2, \[Placeholder]}, {3, \[Placeholder]}, {4, \[Placeholder]}, {5, \[Placeholder]}})

The collection of data is assigned to the variable name data for use with the ListPlot function below.  Make sure you hit the enter key to input the table above into Mathematica. 
 
Aside:  If Num is large, then you have a lot of data, and using a data Table like above is cumbersome. Mathematica allows you to do the same thing using the Table function illustrated below:

data = Table[{nR, W[nR]}, {nR, 0, Num}]

Graph your results of you Table using the Mathematica function ListPlot

ListPlot[data, 
      PlotRange -> {0, 1}, 
PlotStyle -> 
        PointSize[0.02]]

The option PlotStyle->PointSize[0.02] makes the data points a little larger (2% of the size of the screen) for easy viewing.  The option PlotRange->{0,1} makes sure Mathematica draws the axes conventionally.

Calculate the sum of the probabilities using

(∑_(nR = 0)^Num) W[nR]

Explain the answer you obtained.  
Next calculate the average  \(TraditionalForm\`nR\&_\) using

nRave = (∑_(nR = 0)^Num) nR*W[nR]

The theoretical value of this sum is \(TraditionalForm\`nR\&_ = p*Num\).  Does this agree with your answer?  
Next calculate the average of the deviations from the average

(∑_(nR = 0)^Num)(nR - nRave)*W[nR]

Explain your answer.  
Finally calculate (σ^2)  or the average of the square of the deviations from the mean  \(TraditionalForm\`\(\(\(\((nR - nR\&_)\)\^2\)\&_\)\(\ \)\)\) using

(∑_(nR = 0)^Num)(((nR - nRave))^2)*W[nR]

The theoretical answer is (σ^2)=Num*p*q.  Does this agree with your result?

Problem #2:  Consider again the Binomial Distribution for the case where a drunk takes a total of Num=10 steps which is more than the previous problem.  As before take p=q=0.5  Define the function W[nR] and test to make sure it works for some values of nR.

Next collect the data together using the Table function.  Graph the results using the function ListPlot.

Your graph should be symmetric.  Why is this?

Calculate the sum of the probabilities below.  What did you get for the answer?  Explain your answer.

(∑_(nR = 0)^Num) W[nR]

Calculate \(TraditionalForm\`nR\&_\).  Does your answer agree with theory? 
Calculate \(TraditionalForm\`\(σ\^2\)?\ \ Again\ does\ your\ answer\ agree\ with\ \(\(theory\)\(?\)\)\)

Problem #3:  Consider again the Binomial Distribution for the case where a drunk takes a much larger total number of Num=100 steps.  The probability of a step to the right p=0.5 is the same as the probability of a step to the left q=0.5

Define the Binomial distribution function W[nR] for this case and test it to make sure it works for some values of nR.

Next compute W[nR] for all values 0<nR<100 using the Mathematica function Table and assign this to the variable name data.

Graph your results for W[nR] versus nR over the domain {nR, 0, Num}   using the Mathematica ListPlot function.

Your graph should be symmetric.  Why is this?

Calculate the sum of the probabilities below.  What did you get for the answer?  Explain your answer.

Calculate \(TraditionalForm\`nR\&_\).  Does your answer agree with theory? Increasing Num has what effect on \(TraditionalForm\`nR\&_\)?  How does \(TraditionalForm\`nR\&_\)  depend upon Num?  Describe the function.

Calculate \(TraditionalForm\`\(σ\^2\)?\ \ Again\ does\ your\ answer\ agree\ with\ \(\(theory\)\(?\)\)\)  How does (σ^2) depend upon Num?  How does σ depend upon Num?  Describe the function.

How does \(TraditionalForm\`σ\/nR\&_\) depend upon Num? Describe the function.

Problem #4:  Consider again the Binomial Distribution for the case where a drunk takes a much larger total number of Num=100 steps.  The probability of a step to the right p=0.1 is small and quite different from q  the probability of a step to the left q=0.9

Define the Binomial distribution function W[nR] for this case and test it to make sure it works for some values of nR.

Next compute W[nR] for all values 0<nR<100 using the Mathematica function Table and assign this to the variable name data.

Graph your results for W[nR] versus nR over the domain {nR, 0, Num}   using the Mathematica ListPlot function.

Your graph should NOT be symmetric.  Why is this?

Calculate the sum of the probabilities below.  What did you get for the answer?  Explain your answer.

Calculate \(TraditionalForm\`nR\&_\).  Does your answer agree with theory? Increasing Num has what effect on \(TraditionalForm\`nR\&_\)?  How does \(TraditionalForm\`nR\&_\)  depend upon Num?  Describe the function.

Calculate \(TraditionalForm\`\(σ\^2\)?\ \ Again\ does\ your\ answer\ agree\ with\ \(\(theory\)\(?\)\)\)  How does (σ^2) depend upon Num?  How does σ depend upon Num?  Describe the function.

How does \(TraditionalForm\`σ\/nR\&_\) depend upon Num? Describe the function.