tlpipe.utils.robust_stats¶
Robust statistical utilities.
This implements the Median Absolute Deviation (MAD) and some Winsorized statistical methods.
A sample \(x_1, \cdots, x_n\) is sorted in ascending order. For the chosen \(0 \le \gamma \le 0.5\) and \(k = [\gamma n]\) winsorization of the sorted data consists of setting
\[\begin{split}W_i = \left \{ \begin{array}{lll}
x_{(k+1)}, & \mbox{ if } & x_{(i)} \le x_{(k+1)} \\
x_{(i)}, & \mbox{ if } & x_{(k+1)} \le x_{(i)} \le x_{(n-k)} \\
x_{(n-k)}, & \mbox{ if } & x_{(i)} \ge x_{(n-k)}.
\end{array} \right.\end{split}\]
The winsorized sample mean is \(\hat{\mu}_w = \frac{1}{n} \sum_{i=1}^{n} W_i\) and the winsorized sample variance is \(D_w = \frac{1}{n-1} \sum_{i=1}^{n} (W_i - \hat{\mu}_w)^2\).
For this implementation, the statistics is computed for winsorized data with \(\gamma = 0.1\).
Functions
MAD (a) |
Median absolute deviation divides 0.6745. |
mad (a) |
Median absolute deviation. |
winsorized_mean_and_std (a) |
|
winsorized_mode (a) |