Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I only need Help on Part E and F please thank you! Python Programing (15 points) Problem 1: Theory and Computation (Means and Medians) A
I only need Help on Part E and F please thank you!
Python Programing
(15 points) Problem 1: Theory and Computation (Means and Medians) A method to investigate the sensitivity of the sample mean and sample median to extreme outliers and changes in the dataset is to replace one or more elements in a given dataset by a number y and investigate the effect when y changes. To illustrate this, consider the following dataset: 12.2 - 5.0 1.0 3.8 - 4.1 5.9 1.9 9.0 y Part A: Compute the sample mean and sample median for y = 3.5. Then compute both quantities again for y = 6. [2]: #Your Code heremean when y=1.5 import numpy total = [4.2 ,5.1 ,5.0 ,1.5, 3.8, 4.1 ,5.5, 1.9] X = numpy.mean(total) print(x) #median when y=1.5 import numpy total = (4.2 ,5.1 ,5.0 ,1.5, 3.8, 4.1,5.5, 1.9] X = numpy.median (speed) print(x) Part B: Is there a value for y that would make the mean of the data equal to 6? If so, calculate the value of y that makes the mean equal to 6. If not, clearly explain why not. Is there a value for y that would make the median of the data equal to 6? If so, calculate the values of y that makes the median equal to 6. If not, clearly explain why not. Typeset and/or code your solution to part B in this cell or cells Part C: Compute the sample variance and the sample standard deviation for the original dataset given in part A, with y = 6. [3]: #Your code for Part C, here import statistics sample = [4.2 ,5.1 ,5.0 ,6, 3.8, 4.1 ,5.5, 1.9] print("Standard deviation of sample is %s " % (statistics.stdev(sample))) import statistics sample = [4.2 ,5.1 ,5.0 ,6, 3.8, 4.1 ,5.5, 1.9] print("Variance of sample is %s" % (statistics.variance(sample))) Part D: Compute both the sample mean and median for the following cases: y = 9 y = 50 y = 4.36 y 00 y -00 [4]: #Your code for Part D, here Part E: Think about the previous parts, above, and describe in words or mathematical notation the answers to the following two questions: By varying y, what is the set of all the possible values that the sample mean could take on? By varying y, what is the set of all the possible values that the sample median could take on? Specifically, for what sets of y values does the median take on its different possible values? Typeset your solution to part E in this cell or cells Part F: Describe in words or mathematical notation, what happens to the sample standard deviation when y is varied in the following ways: y 00 y + x Typeset your solution to part F in this cell or cells (15 points) Problem 1: Theory and Computation (Means and Medians) A method to investigate the sensitivity of the sample mean and sample median to extreme outliers and changes in the dataset is to replace one or more elements in a given dataset by a number y and investigate the effect when y changes. To illustrate this, consider the following dataset: 12.2 - 5.0 1.0 3.8 - 4.1 5.9 1.9 9.0 y Part A: Compute the sample mean and sample median for y = 3.5. Then compute both quantities again for y = 6. [2]: #Your Code heremean when y=1.5 import numpy total = [4.2 ,5.1 ,5.0 ,1.5, 3.8, 4.1 ,5.5, 1.9] X = numpy.mean(total) print(x) #median when y=1.5 import numpy total = (4.2 ,5.1 ,5.0 ,1.5, 3.8, 4.1,5.5, 1.9] X = numpy.median (speed) print(x) Part B: Is there a value for y that would make the mean of the data equal to 6? If so, calculate the value of y that makes the mean equal to 6. If not, clearly explain why not. Is there a value for y that would make the median of the data equal to 6? If so, calculate the values of y that makes the median equal to 6. If not, clearly explain why not. Typeset and/or code your solution to part B in this cell or cells Part C: Compute the sample variance and the sample standard deviation for the original dataset given in part A, with y = 6. [3]: #Your code for Part C, here import statistics sample = [4.2 ,5.1 ,5.0 ,6, 3.8, 4.1 ,5.5, 1.9] print("Standard deviation of sample is %s " % (statistics.stdev(sample))) import statistics sample = [4.2 ,5.1 ,5.0 ,6, 3.8, 4.1 ,5.5, 1.9] print("Variance of sample is %s" % (statistics.variance(sample))) Part D: Compute both the sample mean and median for the following cases: y = 9 y = 50 y = 4.36 y 00 y -00 [4]: #Your code for Part D, here Part E: Think about the previous parts, above, and describe in words or mathematical notation the answers to the following two questions: By varying y, what is the set of all the possible values that the sample mean could take on? By varying y, what is the set of all the possible values that the sample median could take on? Specifically, for what sets of y values does the median take on its different possible values? Typeset your solution to part E in this cell or cells Part F: Describe in words or mathematical notation, what happens to the sample standard deviation when y is varied in the following ways: y 00 y + x Typeset your solution to part F in this cell or cellsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started