---
output:
  pdf_document: default
  html_document: default
---
# Section 3.2: Expected Value & Variance

## Expected Value (Speegle Ch 3.2)


### Example

Two books are assigned for a statistics class: a textbook costing \$137 and its corresponding study guide costing \$33. The university bookstore determined 20% of enrolled students do not buy either book, 55% buy the textbook only, and 25% buy both books, and these percentages are relatively constant from one term to another.

Let $X$ be a random variable that denotes how much a single student will spend on their statistics book. The pmf is: 


Interpret this value in context: 


Confirm your results using simulation. 




### You try it:

A retirement portfolio's value increases by 18% during a financial boom and by 9% during normal times. It decreases by 12% during a recession. What is the expected return on this portfolio if each scenario is equally likely? 

* Define a random variable.


* Write down the pdf.


* Calculate the theoretical expected value. Write your answer in a full sentence in context of the problem. 


* Confirm using simulation. 


## Variance and standard deviation (Speegle Ch 3.5)

### Example

Let's return to the statistics book example and calculate $Var(X)$ and $SD(X)$. _Recap: The textbook costs \$137, the study guide costing \$33. 20% of students don't buy either book, 55% buy the textbook only, and 25% buy both books._ Confirm your results using simulation.






### You try it:

Return to the retirement portfolio question (_Recap: the value increases by 18% during a financial boom and by 9% during normal times, and decreases by 12% during a recession. Each scenario is equally likely_). Calculate the variance and standard deviation. 

