Exercises 7.9 Exercises
For the following three exercises, edit the blocks of code in Section 7.5 to show results for stopped drivers in Philadelphia rather than in Hartford.
1.
What was the mean age of stopped drivers in Philadelphia during this time? What about the median? Create a histogram of the age
variable from the philadelphia
data (You will only need to load the data in once each time you open this webpage).
2.
Create a table and bar chart of the sex
variable from the philadelphia
data.
3.
In Subsubsection 7.5.2.2 we analyzed how often white and Black drivers were searched after they were stopped, and how often contraband was found among those who were searched, for stopped Hartford drivers. Apply the same techniques to the Philadelphia drivers. Were stopped white or Black drivers searched at a higher rate? Was contraband found at a higher rate among white or Black searched drivers?
For the next two exercises use Bayes' theorem and the Colab notebook.
4.
Recent data has estimated the worldwide percentage of Spam emails as 28.5% [7.10.127]. A new software company states that their product can detect 98% of emails as spam. Sometimes (2%) of the time, the filter incorrectly labels non-spam emails as spam (false positive). With these percentages in mind, what is the true probability that an email, if labeled spam, is actually a non-spam email? (Hint: there are many ways you can approach this, but it may make sense to use A to model an event that an email is labeled spam, and B to represent that the email actually is spam.)
5.
Are white motorists more likely to have a warning issued than Hispanic motorists? Use the Colab notebook to answer this question.