Question: 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
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.950.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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
