Example: Summary Statistics

Summary statistics for a small data set are computed.
using System;
using Imsl.Stat;

public class SummaryEx1
{
	internal static readonly double[] data1 = 
		new double[]{     3, 6.4, 2, 1.6, - 8, 12,
						- 7, 6.4, 22, 1, 0, - 3.2};
	
	public static void  Main(String[] args)
	{
		Summary summary = new Summary();
		summary.Update(data1);
		
		Console.Out.WriteLine
			("The minimum is " + summary.GetMinimum());
		Console.Out.WriteLine();
		
		Console.Out.WriteLine
			("The maximum is " + summary.GetMaximum());
		Console.Out.WriteLine();
		
		Console.Out.WriteLine("The mean is " + summary.GetMean());
		Console.Out.WriteLine();
		
		Console.Out.WriteLine
			("The variance is " + summary.GetVariance());
		Console.Out.WriteLine();
		
		Console.Out.WriteLine
			("The sample variance is " + summary.GetSampleVariance());
		Console.Out.WriteLine();
		
		Console.Out.WriteLine("The standard deviation is " + 
			summary.GetStandardDeviation());
		Console.Out.WriteLine();
		
		Console.Out.WriteLine
			("The skewness is " + summary.GetSkewness());
		Console.Out.WriteLine();
		
		Console.Out.WriteLine
			("The kurtosis is " + summary.GetKurtosis());
		Console.Out.WriteLine();
		
		double[] confmn = new double[2];
		confmn = summary.GetConfidenceMean(0.95);
		Console.Out.WriteLine("The confidence Mean is {" + confmn[0] +
			", " + confmn[1] + "}");
		Console.Out.WriteLine();
		
		double[] confvr = new double[2];
		confvr = summary.GetConfidenceVariance(0.95);
		Console.Out.WriteLine("The confidence Variance is {" + 
			confvr[0] + ", " + confvr[1] + "}");
	}
}

Output

The minimum is -8

The maximum is 22

The mean is 3.01666666666667

The variance is 61.7097222222222

The sample variance is 67.319696969697

The standard deviation is 7.85555359107315

The skewness is 0.863222413428583

The kurtosis is 0.567706048385121

The confidence Mean is {-2.19645146860124, 8.22978480193457}

The confidence Variance is {33.7826187272065, 194.068533277244}

Link to C# source.