Accord.Statistics.Circular.Skewness C# (CSharp) Method

Skewness() public static method

Computes the circular skewness of the given circular angles.
public static Skewness ( double angles ) : double
angles double A double array containing the angles in radians.
return double
        public static double Skewness(double[] angles)
        {
            // compute necessary values
            double theta = Circular.Mean(angles);

            Complex m = CentralMoments(angles, 2);
            double rho2 = m.Magnitude;
            double mu2 = m.Phase;

            // compute skewness 
            double b = 0; // Pewsey, Metrika, 2004
            for (int i = 0; i < angles.Length; i++)
                b += Math.Sin(2 * Distance(angles[i], theta));
            b /= angles.Length;

            /*
            // alternative skewness measure from Fisher
            // Statistical Analysis of Circular Data, p. 34
            double b0 = 0; // (formula 2.29)
            double omR = Math.Pow(1 - R, 3 / 2.0);

            for (int i = 0; i < angles.Length; i++)
                b0 += rho2 * Math.Sin(Distance(mu2, 2 * theta)) / omR;
             */

            return b;
        }