Question: write Python code to demonstrate knowledge of: How to compute quartiles and the interquartile range How to determine if a value is an outlier How
write Python code to demonstrate knowledge of:
How to compute quartiles and the interquartile range
How to determine if a value is an outlier
How to manipulate the mean and the standard deviation of a dataset
Use this Projpy file code to make a ProjRunner.py file:
from ProjRunner import Runner
import sys
import random
from statistics import mean
from statistics import stdev
import matplotlib.pyplot as plt
import numpy as np
#Prepare and print variables that will be used to create
#a dataset.
theMean
theStddev
theNumberSamples
printtheMean theMean
printtheStddev theStddev
printtheNumberSamples theNumberSamples
print
# Generate an approximately normal or Gaussian dataset
nprandom.seed
data listnprandom.normaltheMean theStddev,
theNumberSamples
#Disable the following code to test your code against an
#approximately Gaussian dataset.
#Update the dataset to make it bimodal
data listnprandom.normalinttheMean
theStddev, inttheNumberSamples
printOutput from student code begins here."
#Call the student's run method in a class named Runner in
# the student's file named ProjRunner passing the dataset
# as a parameter.
#The student's code must return the following values in the
# correct order for the #dataset received by the student's code:
Qlower quartile
Qmiddle quartile
Qupper quartile
IQR Interquartile range
LOL lowerOutlierLimit
UOL upperOutlierLimit
MIN minimum value
MAX maximum value
#In addition, the student's code must return the following
#in the correct order:
ax The figure that is to be displayed on the screen
data The dataset shown in the upperright quadrant
data The datsset shown in the lowerleft quadrant
data The dataset shown in the lowerright quadrant
#Call the student code and save the return values.
QQQIQR,LOL,UOL,MIN,MAX,axdata
datadata Runner.rundata
print
Return to code in the driver script."
printusing values returned from student's code.
printQlower quartileroundQ
printQmiddle quartileroundQ
printQupper quartileroundQ
printIQR Interquartile rangeroundIQR
printlowerOutlierLimit roundLOL
printupperOutlierLimitroundUOL
printmin MIN
printmax MAX
print
Comparison of the histogram on top left with
"the other histograms."
topLeftMean roundmeandata
bottomLeftMean roundmeandata
topRightMean roundmeandata
bottomRightMean roundmeandata
topLeftStd roundstdevdata
bottomRightStd roundstdevdata
printMean of top left topLeftMean
printMean of bottom left bottomLeftMean
printMean of top right topRightMean
printMean of bottom right bottomRightMean
print
printStandard deviation of top left topLeftStd
printStandard deviation of bottom right bottomRightStd
printStandard deviation ratio roundbottomRightStdtopLeftStd
#DO NOT include pltshow in your code. Instead, return your figure
#as shown above in the call to your run method.
#Display the graph created and returned by the student's code.
plttightlayout
pltshow
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
