There are several properties of expectation and variance that are consistent through all distributions:
Properties of Expectation
The expected value of two independent random variables is the sum of each expected value separately:
For example, if we wanted to count the total number of heads between 10 fair quarter flips and 6 fair nickel flips, the expected value combined would be 5 heads (from the quarters) and 3 heads (from the nickels) so 8 heads overall.
Multiplying a random variable by a constant a changes the expected value to be a times the expected value of the random variable:
For example, the expected number of heads from 10 fair coin flips is 5. If we wanted to calculate the number of heads from this event run 4 times (40 total coin flips), the expected value would now be 4 times the original expected value, or 20.
Adding a constant a to the distribution changes the expected value by the value a:
Let’s say that a test was given and graded, and the average grade was 78 out of 100 points. If the teacher decided to curve the grade by adding 2 points to everyone’s grade, the average would now be 80 points.
Properties of Variance
Increasing the values in a distribution by a constant a does not change the variance:
This is because the variance of a constant is 0 (there is no range for a single number). Adding a constant to a random variable does not add any additional variance. Let’s take the previous example with the teacher curving grades: though the expected value (or average) of the test changes from 78 to 80, the spread and dispersion (or variance) of the test scores stays the same.
Scaling the values of a random variable by a constant a scales the variance by the constant squared:
The variance of the sum of two random variables is the sum of the individual variances:
This principle ONLY holds if the X and Y are independent random variables. Let’s say that X is the event getting a heads on a single fair coin flip, and Y is the event rolling a 2 on a fair six-sided die:
At the end of the year, your company’s boss decides that the end-of-year bonus will be 8% of each employee’s salary. If the average salary in the company is $75,000, what is the expected value (or average value) of the bonuses?
expected_bonus and set it equal the expected value of the bonuses. Then print
Let’s say that the number of goals a soccer team scores follows the Poisson distribution with lambda equal to four. Uncomment
num_goals and set it equal to 100 random draws from games following this Poisson distribution.
You can do this using the
stats.poisson.rvs() method from the scipy library with lambda equal to four and 100 random draws. Click the hint if you need more guidance.
Print the variance of
Someone thinks that the soccer team is being robbed of goals each game and decides that they are going to count each goal from this team as 2 goals.
num_goals_2 and set it equal to each value of
num_goals multiplied by 2.
Then calculate and print the variance of
num_goals_2 to see that the variance of
num_goals_2 is equal to the variance of
num_goals times two squared (same as times four).