NMath User's Guide

TOC | Previous | Next | Index

38.8 Shape (.NET, C#, CSharp, VB, Visual Basic, F#)

The static Skewness() method on class StatsFunctions computes the skewness of the elements in a data set. Skewness is the degree of asymmetry of a distribution. A distribution is skewed if one of its tails is longer than the other. Thus:

Code Example – C#

double skewness = StatsFunctions.Skewness( data );

Code Example – VB

Dim Skewness As Double = StatsFunctions.Skewness(MyData)

By default, Skewness() uses a biased estimator of the standard deviation (Section 38.7). Alternatively, you can specify the unbiased standard deviation using a value from the BiasType enumeration:

Code Example – C#

double skewness =
  StatsFunctions.Skewness( data, BiasType.Unbiased );

Code Example – VB

Dim Skewness As Double = StatsFunctions.Skewness(MyData, 
  BiasType.Unbiased)

NOTE—StatsSettings.Bias specifies the default BiasType.

Kurtosis() calculates the kurtosis of the elements in a data set. Kurtosis is a measure of the degree of peakedness of a distribution. Again, a biased estimator of the standard deviation is used by default—you can specify the unbiased standard deviation using a value from the BiasType enumeration.

Finally, CentralMoment() returns the moment about the mean of a data set specified by a positive integer order. The first central moment is equal to zero. The second central moment is the variance. The third central moment is the skewness. The fourth central moment is the kurtosis.


Top

Top