(values, threshold = 3)
| 991 | } |
| 992 | |
| 993 | function detectOutliers(values, threshold = 3) { |
| 994 | if (values.length < 3) return { outliers: [], normal: values }; |
| 995 | |
| 996 | const sorted = [...values].sort((a, b) => a - b); |
| 997 | const q1 = sorted[Math.floor(sorted.length * 0.25)]; |
| 998 | const q3 = sorted[Math.floor(sorted.length * 0.75)]; |
| 999 | const iqr = q3 - q1; |
| 1000 | const lowerBound = q1 - threshold * iqr; |
| 1001 | const upperBound = q3 + threshold * iqr; |
| 1002 | |
| 1003 | const outliers = values.filter((v) => v < lowerBound || v > upperBound); |
| 1004 | const normal = values.filter((v) => v >= lowerBound && v <= upperBound); |
| 1005 | |
| 1006 | return { outliers, normal }; |
| 1007 | } |
| 1008 | |
| 1009 | function createCriterionGroupChart( |
| 1010 | entries, |
no outgoing calls
no test coverage detected