Rank() public static method

Gets the rank of a sample, often used with order statistics.
public static Rank ( this samples, bool alreadySorted = false ) : double[]
samples this
alreadySorted bool
return double[]
Exemplo n.º 1
0
        public void RankTest1()
        {
            double[] values = { 2, 3, 4, 4, 5, 6, 8, 10, 10, 14, 16, 20, 32, 40 };

            double[] expected = { 1, 2, 3.5, 3.5, 5, 6, 7, 8.5, 8.5, 10, 11, 12, 13, 14 };
            double[] actual   = Tools.Rank(values);

            Assert.IsTrue(expected.IsEqual(actual));
        }
Exemplo n.º 2
0
        public void RankTest2()
        {
            double[] values = { 7, 1, 2, 1, 7, 8, 1, 1, 2, 0, 10, 27 };
            double[] copy   = (double[])values.Clone();

            double[] expected = { 7.5, 2.5, 5.5, 2.5, 7.5, 9, 2.5, 2.5, 5.5, 0, 10, 11 };
            double[] actual   = Tools.Rank(values);

            Assert.IsTrue(expected.IsEqual(actual));
            Assert.IsTrue(copy.IsEqual(values));
        }