Question: Use Jupyter notebook for your coding Question 1 (5 points) Suppose a COVID-19 rapid test device has a sensitivity (true positive rate) of 0.80 (that

Use Jupyter notebook for your coding

Use Jupyter notebook for your coding Question 1Use Jupyter notebook for your coding Question 1
Question 1 (5 points) Suppose a COVID-19 rapid test device has a sensitivity (true positive rate) of 0.80 (that is 80%). This means that, if a patient (who is infected by SARS-CoV-2) takes a test using this device, there is a 80% of chance that the result shows positive (true positive), and there is a 20% of chance that the result shows negative (false negative). To improve the test sensitvity, we can design a protocol as described as follows: repeat the tests n times using different test devices of the same type; if at least one of the n results are positive, assign positive to the final result, otherwise assign negative to the final result. What is the sensitivity of this protocol? In this Question, your task is to define a function named compute_sen_from_ntests to calculate the sensitivity of the n-test protocol. 1: # define your compute_sen_from_ntests function here (3 marks) def compute_sen_from_ntests (sen, n) : pass # do your work here return sen_n: # test your implementation of compute_sen_from ntests function using sensitivity 0.8, and n = 1, 2, ..., 10 separately. Note: you need to write a for Loop sen = 0.8 for n in range (1, 11): pass # do your work here print ('n = {0), sensitivity = {1}' . format(n, result)) Question 2 (5 points) Suppose the above mentioned COVID-19 rapid test device has a specificity (true negative rate) of 0.75. It means that, if a person (who is NOT infected by SARS-CoV-2) takes a test using this device, there is a 75% chance that the result is negative (true negative), and there is a 25% of chance of that the result is positive (false positive). If we use the same protocol of n tests as in Question 1, what is the corresponding specificity? In this Question, your task is to define a function named compute_spec_from_ntests to calculate the specificity of the n-test protocol. [ ]: # define your compute_spec_from_ntests function here (3 marks) pass # do your work here [ ]: # test your implementation of compute_spec_from ntests here using specificity 0.75, and n = 1, 2, ..., 10 separately, Note: you need to write a for Loop. pass # do your work hereQuestion 3 (4 points) From your observations in Questions 1 and 2, what do you find about the performance of the protocol? To answer this question, we can look at the corresponding accuracy or balanced accuracy. Note that, Accuracy = TN4 FPIFNTP and Balanced Accuracy = TNATP 2 Sensitivity | Specificity . Your task in this question is to define a function named compute_balanced_accuracy_ntests . [ ]: # define you compute_balanced_accuracy_ntests here (2 marks) def compute_balanced_accuracy_ntests (sen, spec, n) : pass # do your work here return bacc_n [ ]: # test your implementation of compute_balanced_accuracy_ntests here for n=1, 2, ...,10 (2 marks) sen = 0.8 spec = 0.75 pass # do your work here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Law Questions!