Question
R programming Driving back from a party, Josephine tries to remember how many alcoholic drinks she had. She concludes it is either 4 or 5,
R programming
Driving back from a party, Josephine tries to remember how many alcoholic drinks she had. She concludes it is either 4 or 5, each with equal probability 1/2. She gets pulled over by a police officer and has to do an alcohol breath test. The probability the test comes up positive depends on how many drinks she actually had. If she had 4, that probability is 60%. If she had 5, that probability is 90%.
Perform the following tasks.
1. Create a vector probas which contains the two probabilities 0.6 and 0.9.
2. Use this vector to compute the probability the test comes out positive, and store the result in a variable called pr.positive.
3. Given that the test returns negative, compute the probability that she actually had 5 drinks, and store the result in a variable called pr.five. Hint: use Bayes theorem.
4. Create a variable called is.smaller which is equal to TRUE if pr.five is strictly smaller than 0.25, and equal to FALSE otherwise. Hint: use a relational operation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started