Standard Deviation

Description

stdev computes the standard deviation of the values in x. If na.rm is TRUE then missing values are removed before computation proceeds. If x is a matrix or a data frame, a vector of the standard deviation of the columns is returned. If unbiased is TRUE then the sample standard deviation is returned, else the population standard deviation is returned.

Usage

1
stdev(x, na.rm, unbiased)

Arguments

x

a numeric vector, matrix or data frame

na.rm

logical value indicating if missing values should be removed.

unbiased

whether to return biased or unbiased standard deviation

Value

Standard deviation of x.

Author(s)

Knut M. Wittkowski kmw@rockefeller.edu

See Also

sd, var

Examples

1
2
3
4
5
x <- c(1, 4, NA, 0, 5)
stdev(x, na.rm=TRUE, unbiased=TRUE)
# [1] 2.380476
stdev(x, na.rm=TRUE, unbiased=FALSE)
# [1] 1.904381