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

KappaTestConstructorTest4() private method

private KappaTestConstructorTest4 ( ) : void
return void
        public void KappaTestConstructorTest4()
        {
            // Example from Statistical Methods for Rates and Proportions

            // Checked against http://graphpad.com/quickcalcs/Kappa2.cfm     (OK)
            // Checked against Statistical Methods for Rates and Proportions (OK)
            // Checked against http://vassarstats.net/kappa.html           (FAIL)

            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));


            double expectedVar = a.Variance;

            // Test against non-null hypothesis
            KappaTest target = new KappaTest(a, hypothesizedKappa: 0.8);

            // Fleiss   reports 0.68  (page 606)
            // Graphpad reports 0.676
            Assert.AreEqual(0.68, target.EstimatedValue, 0.01);
            Assert.AreEqual(a.Kappa, target.EstimatedValue);
            Assert.IsFalse(double.IsNaN(target.EstimatedValue));

            // Fleiss   reports 0.087 (page 607)
            // Graphpad reports 0.088
            Assert.AreEqual(0.087, target.StandardError, 0.001);
            Assert.IsFalse(double.IsNaN(target.StandardError));

            Assert.AreEqual(-1.38, target.Statistic, 0.029);
            Assert.AreEqual(0.1589, target.PValue, 0.0001);

            Assert.IsFalse(target.Significant);
        }