Basic Statistics Review

CMP 464/MAT 788:
Topics Course: Data Science

Spring 2017

Expectations, Trials, and Outcomes

What is the expected value? For random variables, we often cannot predict with certainty the answer. We can measure how likely events are too happen and calculate an expected answer. We are going to perform a series of simple experiments. For each, you will roll the dice (die) 10 times and mark the sum with an 'X'. Also, enter your average value for each.

Histogram for a 12-sided die
                       
                       
                       
10 11 12
Histogram for sum of 2 6-sided dice
                       
                       
                       
1 2 3 4 5 6 7 8 9 10 11 12
Histogram for sum of a 4-sided & 8-sided dice
                       
                       
                       
1 2 3 4 5 6 7 8 9 10 11 12

Expectations

Assuming all the dice are fair, we can easily calculate the expected value of a roll. Let X be the value we roll for a 12-sided die. Let Pr[X = 1] be the probability that we roll a '1', Pr[X = 2] be the probability we roll a '2', etc. We can calculate our expected value by weighting each value by its probability of occurring:
E[X] = 1*(probability of rolling 1) + 2*(probability of rolling 2) + ... + 12*(probability of rolling 12)
          = 1*Pr[X = 1] + 2*Pr[X = 2] + ... + 12*Pr[X = 12]
          = 1 * 1/12 + 2 * 1/12 + ... + 12 * 1/12 
          = 13*6/12 = 13/2 = 6.5
What happens if we have 2 6-sided dice? How many ways can we roll each value?
sum 1 2 3 4 5     6     7     8     9     10   11   12  
ways none 1+1 1+2 1+3                
    2+1 2+2                
      3+1                
                       
                       
                       
Prob: 0 1/36 2/36 3/36                

What happens if we have a 4-sided and 8-sided dice? How many ways can we roll each value?
sum 1 2 3 4 5     6     7     8     9     10   11   12  
ways none 1+1 1+2 1+3 1+4 1+5            
    2+1 2+2 2+3 2+4            
      3+1 3+2 3+3            
        4+1 4+2            
Prob: 0 1/32 2/32 3/32                

The probability of rolling i and then j (to get i+j) is 1/4 * 1/8 = 1/32. What is the expected value?

What happens if we have 3 4-sided dice?

For which set of dice, would you expect the highest value rolled? Why?

Using Python to Model Rolling Dice:

Try the Python program, randomRoll.py that simulates rolling dice and calculates the average value of the simulation and expected value.

Challenges:

If time, here are some challenges based on the Python program: