View Source Statistex.Robust (statistex_robust v0.1.1)
Documentation for Statistex.Robust
.
Robust (range-based) statistics built on Statistex
Summary
Functions
Runs R script to calculate adjusted box for array (https://en.wikipedia.org/wiki/Box_plot).
Runs R script to calculate adjusted_box/1
for indexth matrix row (https://en.wikipedia.org/wiki/Box_plot).
Estimates range using Median Absolute Deviation (MAD).
Estimates range using mad/2
for a specified column (index) of a matrix.
Calculates an asymmetric interval around the median using a modified version of the MAD for skewed data by separating positive and negative deviations from the median.
Estimates range using mad_skew/2
for a specified column (index) of a matrix.
Runs R script to calculate medcouple on array.
Runs R script to calculate medcouple/1
for indexth matrix row.
Calculates the minimum and maximum values for a specific column in a matrix. This method serves only for comparison with robust methods
Estimates range using Z-score.
Estimates range using z_score/2
for index'th row of a matrix.
Functions
Runs R script to calculate adjusted box for array (https://en.wikipedia.org/wiki/Box_plot).
Depends on medcouple calculation (see: Statistex.Robust.medcouple).
Input is sorted automatically.
Examples
iex> Statistex.Robust.adjusted_box([1,1,1,1,1,1])
{1.0, 1.0}
iex> Statistex.Robust.adjusted_box([0,1,2,3,4,5])
{-4.5, 9.5}
Runs R script to calculate adjusted_box/1
for indexth matrix row (https://en.wikipedia.org/wiki/Box_plot).
Depends on medcouple calculation (see: Statistex.Robust.medcouple).
Input is sorted automatically.
Examples
iex> Statistex.Robust.adjusted_box([[1],[1],[1],[1],[1],[1]], 0)
{1.0, 1.0}
Estimates range using Median Absolute Deviation (MAD).
Examples
iex> Statistex.Robust.mad([1, 2, 3, 4, 5, 6, 7], 3)
{-2.0, 10.0}
iex> Statistex.Robust.mad([10, 15, 20, 30, 50], 2)
{0.0, 40.0}
Estimates range using mad/2
for a specified column (index) of a matrix.
Examples
iex> Statistex.Robust.mad([[1], [2], [3], [4], [5], [6], [7]], 3, 0)
{-2.0, 10.0}
iex> Statistex.Robust.mad([[10], [15], [20], [30], [50]], 4, 0)
{-20.0, 60.0}
Calculates an asymmetric interval around the median using a modified version of the MAD for skewed data by separating positive and negative deviations from the median.
Examples
iex> Statistex.Robust.mad_skew([1, 2, 3, 4, 5, 6, 7], 3)
{-0.5, 8.5}
iex> Statistex.Robust.mad_skew([10, 15, 20, 30, 50], 4)
{0.0, 60.0}
Estimates range using mad_skew/2
for a specified column (index) of a matrix.
Examples
iex> Statistex.Robust.mad_skew([[1], [2], [3], [4], [5], [6], [7]], 3, 0)
{-0.5, 8.5}
iex> Statistex.Robust.mad_skew([[10], [15], [20], [30], [50]], 2, 0)
{10.0, 40.0}
Runs R script to calculate medcouple on array.
Note that medcouple does NOT return a range, but a value.
For range estimation using medcouple refer to adjusted_box/1
.
Medcouple is a robust statistic that measures the skewness of a univariate distribution.
Depends on Rscript (https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/Rscript). Depends on library robustbase (https://cran.r-project.org/web/packages/robustbase/index.html)
Rscript has to be available in shell path.
Examples
iex> Statistex.Robust.medcouple([1,1,1,1,1,1])
0.0
iex> Statistex.Robust.medcouple([0,2,2,2,2,5,10])
0.4
Runs R script to calculate medcouple/1
for indexth matrix row.
Examples
iex> Statistex.Robust.medcouple([[1],[1],[1],[1],[1],[1]], 0)
0.0
Calculates the minimum and maximum values for a specific column in a matrix. This method serves only for comparison with robust methods
Parameters
matrix
: A list of lists (matrix) where each inner list represents a row.index
: The index of the column for which to find the minimum and maximum values.
Returns
- A tuple
{min, max}
, representing the minimum and maximum value of the specified column.
Examples
iex> Statistex.Robust.minmax([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 0)
{1, 7}
iex> Statistex.Robust.minmax([[10, 20], [5, 15], [25, 30]], 1)
{15, 30}
Estimates range using Z-score.
Depends on medcouple calculation (see: Statistex.Robust.medcouple).
Input is sorted automatically.
Examples
iex> Statistex.Robust.z_score([39.0157, 50.9985, 45.1634, 63.6410, 48.1637, 54.4420, 56.6881, 49.0387, 51.9994, 45.2520], 3)
{29.837277543944065, 71.04322245605594}
Estimates range using z_score/2
for index'th row of a matrix.
Examples
iex> Statistex.Robust.z_score([[39.0157], [50.9985], [45.1634], [63.6410], [48.1637], [54.4420], [56.6881], [49.0387], [51.9994], [45.2520]], 3,0)
{29.837277543944065, 71.04322245605594}