powered by
Calculates the mean absolute deviation from the sample mean.
aad(x, na.rm = FALSE)
A single number giving the mean absolute deviation.
A numeric vector containing the observations.
Set to TRUE to remove missing values before computing the deviation. Defaults to FALSE.
TRUE
FALSE
Computes the average of the absolute differences between each observation and the sample mean of x, i.e. mean(abs(x - mean(x))).
x
mean(abs(x - mean(x)))
mean, sd, var
mean
sd
var
x <- c(1, 3, 6) aad(x) # missing values x <- c(1, 3, NA, 6) aad(x) # returns NA aad(x, na.rm = TRUE) # ignores the missing value
Run the code above in your browser using DataLab