FUNCTION
Standard_Deviation
Calculates the standard deviation of a given population.
Interface
#include <codecogs/statistics/moments/standard_deviation.h>
using namespace Statistics::Moments;
The standard deviation is defined by the square root of the bias-corrected variance
Physical scientists often use the term root-mean-square as a synonym for standard deviation when they refer to the square root of the mean squared deviation of a quantity from a given baseline. The standard deviation arises naturally in mathematical statistics through its definition in terms of the second central moment. However, a more natural but much less frequently encountered measure of average deviation from the mean that is used in descriptive statistics is the so-called mean deviation.
If the value of the boolean argument total is true, then the standard deviation is computed using the following formula:
References
MathWorld, http:mathworld.wolfram.com/StandardDeviation.html
Example 1
#include <codecogs/statistics/moments/standard_deviation.h>
#include <iostream>
int main()
{
double x[5] = {2.5 , 6.2 , 8.0 , 9.6 , 3.8};
double dev = Stats::Moments::stdev<double>(5, x);
std::cout << "The population standard deviation is: " << dev << std::endl;
return 0;
}Output:
The population standard deviation is: 2.9192