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

KappaTestConstructorTest() private method

private KappaTestConstructorTest ( ) : void
return void
        public void KappaTestConstructorTest()
        {
            // Example from http://vassarstats.net/kappa.html

            // Checked against http://graphpad.com/quickcalcs/Kappa2.cfm     (OK)

            int[,] matrix =
            {
                { 44,  5,  1 },
                {  7, 20,  3 },
                {  9,  5,  6 },
            };

            GeneralConfusionMatrix a = new GeneralConfusionMatrix(matrix);

            Assert.AreEqual(a.RowTotals[0], 50);
            Assert.AreEqual(a.RowTotals[1], 30);
            Assert.AreEqual(a.RowTotals[2], 20);

            Assert.AreEqual(a.ColumnTotals[0], 60);
            Assert.AreEqual(a.ColumnTotals[1], 30);
            Assert.AreEqual(a.ColumnTotals[2], 10);


            Assert.AreEqual(0.4915, a.Kappa, 1e-4);
            Assert.IsFalse(double.IsNaN(a.Kappa));

            double var = a.Variance;
            double var0 = a.VarianceUnderNull;
            double varD = Accord.Statistics.Testing.KappaTest.DeltaMethodKappaVariance(a);

            double se = System.Math.Sqrt(var);
            double se0 = System.Math.Sqrt(var0);
            double seD = System.Math.Sqrt(varD);

            Assert.AreEqual(0.072, a.StandardError, 0.0005);

            // Create a test of the null hypothesis (actual k = 0)
            KappaTest target = new KappaTest(a, hypothesizedKappa: 0);

            // Std. Error is computed differently under the null hypothesis:
            Assert.AreEqual(0.073509316753225237, target.StandardError, 1e-5);
            Assert.IsFalse(double.IsNaN(target.StandardError));
        }