Accord.Tests.Statistics.KappaTestTest.KappaTestConstructorTest5 C# (CSharp) Method

KappaTestConstructorTest5() private method

private KappaTestConstructorTest5 ( ) : void
return void
        public void KappaTestConstructorTest5()
        {
            // Example from Statistical Methods for Rates and Proportions
            // for kappa variance under the null hypothesis

            // Checked against Statistical Methods for Rates and Proportions (OK)


            int[,] matrix = // (pg 599)
            {
                { 75,  1, 4  },
                {  5,  4, 1  },
                {  0,  0, 10 },
            };

            GeneralConfusionMatrix a = new GeneralConfusionMatrix(matrix);

            Assert.AreEqual(100, a.Samples);

            Assert.AreEqual(80, a.RowTotals[0]);
            Assert.AreEqual(10, a.RowTotals[1]);
            Assert.AreEqual(10, a.RowTotals[2]);

            Assert.AreEqual(80, a.ColumnTotals[0]);
            Assert.AreEqual(5, a.ColumnTotals[1]);
            Assert.AreEqual(15, a.ColumnTotals[2]);

            double[,] proportions = // (pg 599)
            {
                { 0.75, 0.01, 0.04 },
                { 0.05, 0.04, 0.01 },
                { 0.00, 0.00, 0.10 },
            };

            Assert.IsTrue(proportions.IsEqual(a.ProportionMatrix));

            // Test under null hypothesis
            KappaTest target = new KappaTest(a, hypothesizedKappa: 0,
                alternate: OneSampleHypothesis.ValueIsGreaterThanHypothesis);

            Assert.AreEqual(0.68, target.EstimatedValue, 0.01); // pg 605
            Assert.AreEqual(a.Kappa, target.EstimatedValue);
            Assert.IsFalse(double.IsNaN(target.EstimatedValue));

            Assert.AreEqual(0.076, target.StandardError, 0.001);
            Assert.IsFalse(double.IsNaN(target.StandardError));

            Assert.AreEqual(8.95, target.Statistic, 0.08);

            Assert.IsTrue(target.Significant);
        }