Python Functions for Statistical Applications 1A. Implementation with the standard def keyword Suppose you have done a statistical comparison using the Z-scores approach. Write a function for calculating the lower bound of the 95% CI. A starter code for this function is already provided to you below. def compute_lower_bound(n, mu, stdev, z=1.96): """ Computes lower bound of a confidence interval Parameters: n: Type int. number of data points mu: Type float. sample mean stdev: Type float. sample standard deviation z: Type float. critical value. Default to 95%CI that corresponds to value of 1.96 """ # YOUR CODE HERE # Hint: A correct implementation can be as short as just 1 line long! 1B. Using the function of Part 1A Run your function on the following scenario: There are 500 data points. The sample mean is 2525 The sample standard deviation is 7.57.5 The critical value at 95% confidence, ?0.95�0.95, is a constant: 1.96 # YOUR CODE HERE 1C. Application of Part 1A Now, you are asked to do the same computation as above, except for 99% CI now. Hints: Make a change to the function call, not the function itself Consider Googl'ing the "99% confidence interval" # YOUR CODE HERE
Python Functions for Statistical Applications
1A. Implementation with the standard def keyword
Suppose you have done a statistical comparison using the Z-scores approach. Write a function for calculating the lower bound of the 95% CI. A starter code for this function is already provided to you below.
def compute_lower_bound(n, mu, stdev, z=1.96):
"""
Computes lower bound of a confidence interval
Parameters:
n: Type int. number of data points
mu: Type float. sample mean
stdev: Type float. sample standard deviation
z: Type float. critical value. Default to 95%CI that corresponds to value of 1.96
"""
# YOUR CODE HERE
# Hint: A correct implementation can be as short as just 1 line long!
1B. Using the function of Part 1A
Run your function on the following scenario:
There are 500 data points.
The sample mean is 2525
The sample standard deviation is 7.57.5
The critical value at 95% confidence, ?0.95�0.95, is a constant: 1.96
# YOUR CODE HERE
1C. Application of Part 1A
Now, you are asked to do the same computation as above, except for 99% CI now.
Hints:
Make a change to the function call, not the function itself
Consider Googl'ing the "99% confidence interval"
# YOUR CODE HERE
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)