diff options
Diffstat (limited to 'stats.py')
| -rw-r--r-- | stats.py | 6 |
1 files changed, 6 insertions, 0 deletions
| @@ -13,6 +13,12 @@ def iqr(vect): | |||
| 13 | def cutoff_max(vect, percentile=99): | 13 | def cutoff_max(vect, percentile=99): |
| 14 | return s.scoreatpercentile(vect, percentile) | 14 | return s.scoreatpercentile(vect, percentile) |
| 15 | 15 | ||
| 16 | def iqr_cutoff(vect, extend): | ||
| 17 | (spread, low, high) = iqr(vect) | ||
| 18 | min_val = low - extend * spread | ||
| 19 | max_val = high + extend * spread | ||
| 20 | return min_val, max_val | ||
| 21 | |||
| 16 | def iqr_is_not_outlier(table, col=1, extend=1.5): | 22 | def iqr_is_not_outlier(table, col=1, extend=1.5): |
| 17 | "create a filter function that flags outliers" | 23 | "create a filter function that flags outliers" |
| 18 | (spread, low, high) = iqr(table[:,col]) | 24 | (spread, low, high) = iqr(table[:,col]) |
