示例#1
0
 def DeleteExtremeOutliers(
         self,
         mylist):  #Delete only the  extreme ouliers in a given data set
     A = BasicStatisticalMeasures()
     Q1 = A.quantile(mylist)[1]
     Q3 = A.quantile(mylist)[3]
     IQ = A.IQR(mylist)
     LOF = Q1 - 3 * IQ
     UOF = Q3 + 3 * IQ
     i = 0
     listx = []
     for value in mylist:
         if not (
                 value < LOF or value > UOF
         ):  #If the value is  beyond the outer fence ([LOF,UOF]) on either side (extreme outlier) doesn't pass the control and deleted
             listx.append(value)
         i += 1
     return listx
示例#2
0
 def DeleteOutliers(
     self, mylist
 ):  #Delete the ouliers (both mild and extreme) in a given data set
     A = BasicStatisticalMeasures(
     )  #Call the BasicStatisticalMeasures to calculate the quantiles and interquartile range
     Q1 = A.quantile(mylist)[1]
     Q3 = A.quantile(mylist)[3]
     IQ = A.IQR(mylist)
     LIF = Q1 - 1.5 * IQ  #Calculate the lower inner fence
     UIF = Q3 + 1.5 * IQ  #Calculate the upper inner fence
     LOF = Q1 - 3 * IQ  #Calculate the lower outer fence
     UOF = Q3 + 3 * IQ  #Calculate the upper outer fence
     i = 0
     listx = []
     for value in mylist:
         if not (
             (value < LOF or value > UOF) or (value < LIF or value > UIF)
         ):  #If the value is beyond the inner fence ([LIF,UIF]) on either side (mild outlier) or beyond the outer fence ([LOF,UOF]) on either side (extreme outlier) doesn't pass the control and deleted
             listx.append(value)
         i += 1
     return listx