Part (a) Write a python function that computes the binomial coefficient (:). The function should return the correct answer for any positive integer n and k where k < n. n [1]: import matplotlib.pyplot as plt n [2]: # your code here def binomial (n,k): # returns the binomial coefficient nCk pass

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Part (a)
Write a python function that computes the binomial coefficient ("). The function should return the correct answer for any positive integer n and k where
k<n.
in [1]: import matplotlib.pyplot as plt
In [2]: # your code here
def binomial (n,k):
# returns the binomial coefficient nCk
pass
Part (b)
• Write a function that computes the probability of the test accepting the null hypothesis given fixed values of m, n, p,
• Write another function that gives the probability of the test rejecting the null hypothesis given m, n and p.
You may use part (a) and you may call the first function from the second one (and/or viceversa).
In [3]: # your code here
def accept (n,m,p):
# returns the probability that k <m
pass
def reject (n,m,p):
#return the probability that k >=m
pass
Part (c)
Suppose that the number of people in the trial is 100. Then:
• Plot a curve that shows how the probability of type 1 error changes with the choice of m, for m = 1,...n assuming that the null hypothesis holds (in red),
• On the same picture, plot the probability of type 2 error vs the value of m in the case in which the new drug is effective with proability 0.68 (in blue).
You can plot the two curves using matplotlib.pyplot. You can select the color by passing color='r' or color='b' to the plt.plot() function.
[4]: n - 100
# your code here
def plot_curve ():
pass
[5]: plot_curve()
Part (d)
Based on the picture above, what value of m do you think would be suitable to keep both type 1 and type 2 error small at the same time?
(You may assume that the company claims the new drug has 68% accuracy)
[6]: # your solution here
Transcribed Image Text:Part (a) Write a python function that computes the binomial coefficient ("). The function should return the correct answer for any positive integer n and k where k<n. in [1]: import matplotlib.pyplot as plt In [2]: # your code here def binomial (n,k): # returns the binomial coefficient nCk pass Part (b) • Write a function that computes the probability of the test accepting the null hypothesis given fixed values of m, n, p, • Write another function that gives the probability of the test rejecting the null hypothesis given m, n and p. You may use part (a) and you may call the first function from the second one (and/or viceversa). In [3]: # your code here def accept (n,m,p): # returns the probability that k <m pass def reject (n,m,p): #return the probability that k >=m pass Part (c) Suppose that the number of people in the trial is 100. Then: • Plot a curve that shows how the probability of type 1 error changes with the choice of m, for m = 1,...n assuming that the null hypothesis holds (in red), • On the same picture, plot the probability of type 2 error vs the value of m in the case in which the new drug is effective with proability 0.68 (in blue). You can plot the two curves using matplotlib.pyplot. You can select the color by passing color='r' or color='b' to the plt.plot() function. [4]: n - 100 # your code here def plot_curve (): pass [5]: plot_curve() Part (d) Based on the picture above, what value of m do you think would be suitable to keep both type 1 and type 2 error small at the same time? (You may assume that the company claims the new drug has 68% accuracy) [6]: # your solution here
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY