Sample Standard Deviation Function
Jump to navigation
Jump to search
A Sample Standard Deviation Function is a Function that describes the dispersion of a Numeric Sample Space around its Mean Value.
- AKA: Standard Deviation, σ.
- Context:
- Input: a Numeric Sample Space.
- Output: a Real Number in the same Units as the Input.
- Examples(s):
- See: Sample Variance Function, Mean Function.
References
2009
- (Wikipedia, 2009) ⇒ http://en.wikipedia.org/wiki/Standard_deviation
- In statistics, standard deviation is a simple measure of the variability or dispersion of a data set. A low standard deviation indicates that all of the data points are very close to the same value (the mean), while high standard deviation indicates that the data are “spread out” over a large range of values.
- Let X be a random variable with mean value μ:
- E[X] = \mu\,\!
- Here E denotes the average or expected value of X. Then the standard deviation of X is the quantity
- \sigma = \sqrt{E\left[(X - \mu)^2\right]}.
- That is, the standard deviation σ is the square root of the average value of (X – μ)2.
- In the case where X takes random values from a finite data set x_1, x_2, \ldots, x_N, with each value having the same probability, the standard deviation is
- \sigma = \sqrt{\frac{(x_1-\mu)^2 + (x_2-\mu)^2 + … + (x_N - \mu)^2}{N}},
- or, using summation notation,
- \sigma = \sqrt{\frac{1}{N} \sum_{i=1}^N (x_i - \mu)^2},
- The standard deviation of a (univariate) probability distribution is the same as that of a random variable having that distribution. Not all random variables have a standard deviation, since these expected values need not exist. For example, the standard deviation of a random variable which follows a Cauchy distribution is undefined because its E(X) is undefined.
2007
#!/usr/bin/perl
my $total = 0;
foreach my $v (@data) {$total += $v}
my $average = $total / @data;
my $sqtotal = 0;
foreach my $v (@data) {
$sqtotal += ($average-$v) 2;
}
my $std = ($sqtotal / @data) 0.5;