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

std

Standard Deviation (Matlab Style)


Description

Standard deviation of the values of x.

Usage

std(x, flag=0)

Arguments

x

numeric vector or matrix

flag

numeric scalar. If 0, selects unbiased algorithm; and if 1, selects the biased version.

Details

If flag = 0 the result is the square root of an unbiased estimator of the variance. std(X,1) returns the standard deviation producing the second moment of the set of values about their mean.

Value

Return value depends on argument x. If vector, returns the standard deviation. If matrix, returns vector containing the standard deviation of each column.

Note

flag = 0 produces the same result as R's sd().

Examples

std(1:10)          # 3.027650
std(1:10, flag=1)  # 2.872281

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

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