sd2: Custom standard deviation

Description Usage Arguments Details Value Examples

View source: R/stats.R

Description

Inject a different summary statistic for the mean and adjust the bias correction term

Usage

1
sd2(x, fun = mean, correction = 1, ...)

Arguments

x

a numeric vector

fun

summary statistic, measure of central tendency. Defaults to mean

correction

bias correction amount (e.g. 1.5), defaults to 1.

...

additional arguments passed to fun

Details

The square root of the euclidean distance from some central value (determined by the summary statistic function fun) and divided by the length of x minus some correction value is returned.

Value

scalar

Examples

1
2
3
4
5
6
x <- rgamma(100, 1, 1)
sd(x)                    # standard
sd2(x)                   # same as above
sd2(x, correction=1.5)   # 1.5 bias correction
sd2(x, logmean, 1)       # geometric mean, correction=1
sd2(x, logmean, 1.5)     # geometric mean, correction=1.5

iamamutt/mejr documentation built on May 18, 2019, 1:27 a.m.