Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STAT 4198

Homework 3

Spring 2023

1.     A new drug has been developed to cure a rare disease. 20 people infected with the disease are randomly selected and 16 of them are cured. A previous drug on the    market has a success rate of 0.6 at curing the disease.

a)    Use a Uniform(0, 1) prior  for 9 and do the following:

•   Calculate the posterior distribution of 9 and plot it.

•   Give a 95% credible interval for  9. Is the hypothesis of that the new drug is as effective as the old drug credible (i.e. 9 = 0.6)?

•   Test H0 : 9 ≤ 0.6 versus Ha : 9 > 0.6

•   Calculate the Bayes Factor when comparing the models: M1: 9= 0.6, and M2: 9~ Uniform(0, 1). Interpret this Bayes Factor.

b)    Suppose an expert suggests that he thinks the probability of an infected individual  being cured is about 0.7, and he is 95% sure that the probability is between 0.5 and 0.9. Specify a Beta prior that takes into account the expert’s opinion. Repeat part a) using the new posterior distribution.

C)    Suppose a random sample of 10 infected individuals are selected and are given the drug.  Use your posterior distribution from part b) to calculate the probability that at least 8 will be cured. Do this by performing 100,000 simulations, and seeing how many times there were at least 8 people cured.

2.   An occasionally dishonest casino uses 2 types of dice. Of its dice, 97% are fair but 3% are unfair, and a five comes up 35% of the time for these unfair dice. The probability of a five on the fair dice is 1/6.

a)  Suppose you pick a die randomly and roll it, and you rolled a five. What is the probability that you had picked an unfair die? What is the Bayes Factor?

b)  Suppose you roll it again and get another five. What is the probability that you had picked an unfair die? What is the Bayes Factor?

c)  How  many  "fives"  in  a  row  would  you  need  to  see  before  it  was  most  likely  (i.e. probability greater than 0.5) that you had picked an unfair die? What is the Bayes Factor?

d)  Suppose in total you roll it 100 times and observe 30 fives. What is the probability that you had picked an unfair fie? What is the Bayes Factor?

3.   Use a Monte Carlo method to solve the disease problem from Week 1 in class: suppose a certain disease is randomly found in 1% of the population. A clinical blood test is 99%    accurate in detecting the presence of the disease, but it also yields a 5% false positive     rate. What is the probability that an individual has the disease given that they tested positive?

Simulate this experiment 100,000 times, and see how many ofthe times that a positive test was seen, that it was seen from an infected person.

4.   Suppose you are running an online subscription-based service. Let’s assume:

•    The subscription fee is $10 per month per user and can be cancelled any month

•    You currently have 10,000 users. Your monthly recurring revenue MRR is 10,000 x $10 = $100,000.

•    Your annual cost of maintaining the service is fixed at $1 million per year regardless of users.

•    The monthly net growth in the % of users is Normally distributed with mean 0 and standard deviation 5.

You want to set aside enough cash today to ensure, with 99% confidence, that you will have at least $1 million to pay for your annual costs of maintaining the service next      year.

What we can do in this case is simulate scenarios of what the next 12 months could look like.

In the example below, the -1.72% growth in Month 1 was randomly simulated from a     Normal(0, 5), the 0.79% growth for Month 2, and so on. Next, based on the randomly     simulated 12 months, the total revenue accumulated over the simulated 12 months was calculated.

Month     Growth      Users        Revenue

1

-1.72%

9828

$98,280

2

0.79%

9906

$99,060

3

2.42%

10145

$101,450

4

1.99%

10347

$103,470

5

-0 67%

10277

$102,770

6

-0.02%

10275

$102,750

7

0.32%

10307

$103,070

8

-1.37%

10165

$101,650

9

1.46%

10313

$103, 130

10

8.95%

11236

$112,360

11

-5.92%

10571

$105,710

12

1.82%

10763

$107,630

Total      $1,241,330

In the above example, we can see that $1.24 million was generated in this scenario which is enough to cover the $1 million of expenses. If the revenue is below $1 million we should have access to some cash that was set aside in order to cover the expenses.

Simulate this scenario 100,000 times and give the following:

•   A plot of the distribution of the annual revenue.

•   The average annual across all 100,000 simulated scenarios.

•   The amount of money needed to set aside to be 99% confident of being able to pay the $1 million of annual expenses in the next year.