| window | integer/[offset string](docs/ParameterDescriptions.md#offset-strings) | | size of the sliding window, where the modified Z-score is applied on |
| z | float | `3.5` | z-parameter of the modified Z-score |
This functions flags outliers using the simple median absolute deviation test.
Values are flagged if they fulfill the following condition within a sliding window:
```math
0.6745 * |x - m| > mad * z > 0
```
where $`x`$ denotes the window data, $`m`$ the window median, $`mad`$ the median
absolute deviation and $`z`$ the $`z`$-parameter of the modified Z-Score.
The window is moved by one time stamp at a time.
NOTE:
This function should only be applied on normalized data.
| raise_factor | float | `0.15` | Minimum relative value difference between two values to consider the latter as a spike candidate. See condition (1) |
| noise_func | [string](#noise-detection-functions) | `"CoVar"` | Function to calculate noisiness of the data surrounding potential spikes |
| noise_window | [offset string](docs/ParameterDescriptions.md#offset-strings) | `"12h"` | Determines the range of the time window of the "surrounding" data of a potential spike. See condition (3) |
| noise_thresh | float | `1` | Upper threshold for noisiness of data surrounding potential spikes. See condition (3) |
| smooth_window | [offset string](docs/ParameterDescriptions.md#offset-strings) | `None` | Size of the smoothing window of the Savitsky-Golay filter. The default value `None` results in a window of two times the sampling rate (i.e. three values) |
| smooth_poly_deg | integer | `2` | Degree of the polynomial used for fitting with the Savitsky-Golay filter |
The function flags spikes by evaluating the time series' derivatives
and applying various conditions to them.
The value $`x_{k}`$ of a time series $`x_t`$ with
timestamps $`t_i`$ is considered a spikes, if:
1. The quotient to its preceding data point exceeds a certain bound:
* $` |\frac{x_k}{x_{k-1}}| > 1 + `$ `raise_factor`, or
| thresh | float | | The threshold, for the total rise (`thresh` $` > 0 `$ ), or total drop (`thresh` $` < 0 `$ ), that value courses must not exceed within a timespan of length `raise_window` |
| raise_window | [offset string](docs/ParameterDescriptions.md#offset-strings) | | The timespan, the rise/drop thresholding refers to. Window is inclusively defined. |
| intended_freq | [offset string](docs/ParameterDescriptions.md#offset-strings) | | The frequency, timeseries to-be-flagged is supposed to be sampled at. Window is inclusively defined. |
| average_window | [offset string](docs/ParameterDescriptions.md#offset-strings) | `None` | See condition (2) below. Window is inclusively defined. The window defaults to 1.5 times the size of `raise_window` |
The function flags rises and drops in value courses, that exceed the threshold
given by `thresh` within a timespan shorter than, or equalling the time window
given by `raise_window`.
Weather rises or drops are flagged, is controlled by the signum of `thresh`.
(positive->rises, negative->drops)
The parameter variety of the function is owned to the intriguing
case of values, that "return" from outlierish or anomalious value levels and
thus exceed the threshold, while actually being usual values.
The value $`x_{k}`$ of a time series $`x`$ with associated
timestamps $`t_i`$, is flagged a rise, if:
1. There is any value $`x_{s}`$, preceeding $`x_{k}`$ within `raise_window` range, so that:
* $` M = |x_k - x_s | > `$ `thresh` $` > 0`$
2. The weighted average $`\mu^*`$ of the values, preceeding $`x_{k}`$ within `average_window` range indicates, that $`x_{k}`$ doesnt return from an outliererish value course, meaning that:
3. Additionally, if `min_slope` is not `None`, $`x_{k}`$ is checked for being sufficiently divergent from its very predecessor $`x_{k-1}`$, meaning that, it is additionally checked if: