mad

Defined in fynance.features.metrics

mad(X, axis=0, dtype=None)[source]

Compute the Mean Absolute Deviation of each X’ series.

Compute the mean of the absolute value of the distance to the mean [6].

Parameters:
Xnp.ndarray[np.dtype, ndim=1 or 2]

Time-series of prices, performances or index.

axis{0, 1}, optional

Axis along wich the computation is done. Default is 0.

dtypenp.dtype, optional

The type of the output array. If dtype is not given, infer the data type from X input.

Returns:
dtype or np.ndarray[dtype, ndim=1]

Values of mean absolute deviation of each series.

See also

roll_mad

References

Examples

>>> X = np.array([70., 100., 90., 110., 150., 80.])
>>> mad(X)
20.0