Interface
#include <codecogs/statistics/moments/statistics.h>
using namespace Stats::Moments;
| template<...> class | Statistics ()
Calculates the statistics for a set of data that may change size frequently. |
Use the following HTML code to embed the calculators within other websites:
Statistics
This class allows the calculation of key statistics for a set of data that may change its size frequently. The main
advantage of this class is the ability of updating the key statistics while storing minimum information about previous
data into a set of main variables given below, rather than storing the actual data. Based on the next main variables,
that are recalculated with each new value that is added to the population,
it calculates the statistics using the following formulas
where
mean is the arithmetic mean,
geomean is the geometric mean,
harmean is the harmonic mean,
var </em> is the
variance and
stdev is the standard deviation. The skewness and kurtosis are calculated using similar formulas.
A C# version of this class is available when you obtain a licence
References:
Example 1
#include <codecogs/statistics/moments/statistics.h>
#include <iostream>
int main()
{
double a[15];
for (int i = 0; i < 15; i++)
a[i]=i+1;
a[1]=5;
Stats::Moments::Statistics<double> stats(15, a);
stats.print();
return 0;
}
Output:
Total = 123.0000000000
Arithmetic Mean = 8.2000000000
Geometric Mean = 6.8280387111
Harmonic Mean = 4.9698018386
Variance = 18.0285714286
Standard Deviation = 4.2460065271
Skewness = 0.0403100873
Kurtosis = -1.0487842858
Authors
- Anca Filibiu (August 2005)
Source Code
Source code is available when you buy a Commercial licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.