Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Corporate Financial Accounting

Authors: Carl S. Warren, James M. Reeve, Jonathan Duchac

14th edition

130565353X, 978-1305887510, 1305887514, 978-1305653535

Students also viewed these Mathematics questions

Question

Will you be able to pay your bills?

Answered: 1 week ago