Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

aad

Mean (average) absolute deviation from the mean


Description

Calculates the mean absolute deviation from the sample mean.

Usage

aad(x, na.rm = FALSE)

Arguments

x

A vector containing the observations.

na.rm

A logical value indicating whether or not missing values should be removed. Defaults to FALSE

Details

The aad function calculates the average (i.e. mean) absolute deviation from the mean value of x, removing NA values if requested by the user. It exists primarily to simplify the discussion of descriptive statistics during an introductory stats class.

Value

Numeric.

Warning

This package is under development, and has been released only due to teaching constraints. Until this notice disappears from the help files, you should assume that everything in the package is subject to change. Backwards compatibility is NOT guaranteed. Functions may be deleted in future versions and new syntax may be inconsistent with earlier versions. For the moment at least, this package should be treated with extreme caution.

Author(s)

Daniel Navarro

See Also

Examples

# basic usage
X <- c(1, 3, 6)  # data 
aad(X)           # returns a value of 2

# removing missing data
X <- c(1, 3, NA, 6)   # data 
aad(X)                # returns NA 
aad(X, na.rm = TRUE)  # returns 2

lsr

Companion to "Learning Statistics with R"

v0.5
GPL-3
Authors
Daniel Navarro
Initial release
2015-03-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.