Exercise 11 - Odds of Winning Florida
According to this analysis, what was the probability that Trump wins Florida?
This exercise is part of the course
HarvardX Data Science Module 4 - Inference and Modeling
Exercise instructions
- Using the
pnorm
function, calculate the probability that the spread in Florida was less than 0.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Assign the expected value of the posterior distribution to the variable `exp_value`
exp_value <- B*mu + (1-B)*Y
# Assign the standard error of the posterior distribution to the variable `se`
se <- sqrt( 1/ (1/sigma^2 + 1/tau^2))
# Using the `pnorm` function, calculate the probability that the actual spread was less than 0 (in Trump's favor). Print this value to the console.