aad: Mean (average) absolute deviation from the mean

Description Usage Arguments Details Value Examples

View source: R/aad.R

Description

Calculates the mean absolute deviation from the sample mean

Usage

1
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

Examples

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

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

lsr documentation built on Dec. 11, 2021, 9:10 a.m.

Related to aad in lsr...