Previous topic

fynance.features.metrics.drawdown

Next topic

fynance.features.metrics.mdd

fynance.features.metrics.mad

fynance.features.metrics.mad(X, axis=0, dtype=None)

Compute the Mean Absolute Deviation of each X’ series.

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

Parameters:
X : np.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.

dtype : np.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

[6]https://en.wikipedia.org/wiki/Average_absolute_deviation

Examples

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