Skip to contents

The Pooled Standard Deviation is a weighted average of standard deviations for two or more groups, assumed to have equal variance. It represents the common deviation among the groups, around each of their respective means.

Usage

sd_pooled(x, y = NULL, data = NULL, verbose = TRUE)

mad_pooled(x, y = NULL, data = NULL, constant = 1.4826, verbose = TRUE)

Arguments

x

A formula, a numeric vector, or a character name of one in data.

y

A numeric vector, a grouping (character / factor) vector, a or a character name of one in data. Ignored if x is a formula.

data

An optional data frame containing the variables.

verbose

Toggle warnings and messages on or off.

constant

scale factor.

Value

Numeric, the pooled standard deviation.

Details

The standard version is calculated as: $$\sqrt{\frac{\sum (x_i - \bar{x})^2}{n_1 + n_2 - 2}}$$ The robust version is calculated as: $$1.4826 \times Median(|\left\{x - Median_x,\,y - Median_y\right\}|)$$

See also

Examples

sd_pooled(mpg ~ am, data = mtcars)
#> [1] 4.902029
mad_pooled(mtcars$mpg, factor(mtcars$am))
#> [1] 6.704213