The OpenD Programming Language

medianAbsoluteDeviation

Calculates the median absolute deviation about the median of the input.

By default, if F is not floating point type, then the result will have a double type if F is implicitly convertible to a floating point type.

  1. template medianAbsoluteDeviation(F)
  2. meanType!(Slice!(Iterator, N, kind)) medianAbsoluteDeviation(Slice!(Iterator, N, kind) slice)
    meanType!(Slice!(Iterator, N, kind))
    medianAbsoluteDeviation
    (
    Iterator
    size_t N
    SliceKind kind
    )
    (
    Slice!(Iterator, N, kind) slice
    )
  3. meanType!(T[]) medianAbsoluteDeviation(T[] ar)
  4. auto medianAbsoluteDeviation(SliceLike x)

Return Value

Type: meanType!(Slice!(Iterator, N, kind))

The median absolute deviation of the input

Examples

medianAbsoluteDeviation of vector

import mir.math.common: approxEqual;
import mir.ndslice.slice: sliced;

auto x = [0.0, 1.0, 1.5, 2.0, 3.5, 4.25,
          2.0, 7.5, 5.0, 1.0, 1.5, 0.0].sliced;

assert(x.medianAbsoluteDeviation.approxEqual(1.25));

Median Absolute Deviation of matrix

import mir.math.common: approxEqual;
import mir.ndslice.fuse: fuse;

auto x = [
    [0.0, 1.0, 1.5, 2.0, 3.5, 4.25],
    [2.0, 7.5, 5.0, 1.0, 1.5, 0.0]
].fuse;

assert(x.medianAbsoluteDeviation.approxEqual(1.25));

Median Absolute Deviation of dynamic array

import mir.math.common: approxEqual;

auto x = [0.0, 1.0, 1.5, 2.0, 3.5, 4.25,
          2.0, 7.5, 5.0, 1.0, 1.5, 0.0];

assert(x.medianAbsoluteDeviation.approxEqual(1.25));

Meta