Function computes MAD statistic(s) for numeric vector. All values in vector are used to create MAD statistic. MAD values for all or last entry alone can be returned.
Usage
roll_mad(values, last = F)
Arguments
- values
vector of numeric values to MAD.
- last
boolean - determines if last value should only be returned. Default is `FALSE`.
Value
returns a single MAD value for the last value in vector
Examples
if (FALSE) { # \dontrun{
numeric_vector = c(rnorm(10, 10, 3), 100)
roll_mad(numeric_vector)
roll_mad(numeric_vector, last = T)
#compare to zscore
scale(numeric_vector)[,1]
} # }