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
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...
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F264ab040-5d26-4efd-98d6-6b8e821ec948%2Fce8bdafa-b3ef-4f23-bcfa-ccfdd3c26e24%2F70na5_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
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](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY