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

KappaTestConstructorTest2() private method

private KappaTestConstructorTest2 ( ) : void
return void
        public void KappaTestConstructorTest2()
        {
            // Example from: M. Reichenheim (2004). Confidence intervals for the
            // kappa statistic. The Stata Journal (2004) 4, Number 4, pp. 421–428.
            // http://www.stata-journal.com/sjpdf.html?articlenum=st0076

            int[,] matrix = // (pg 599)
            {
                { 48,  12 },
                { 16, 160 },
            };

            GeneralConfusionMatrix a = new GeneralConfusionMatrix(matrix);

            // Reichenheim's paper shows:
            // Agreement | Expected Agreement | Kappa  | Std. Error |   Z
            //   88.14%  |       61.25%       | 0.6938 |   0.0650   | 10.67

            Assert.AreEqual(88.14, a.OverallAgreement * 100, 1e-2);
            Assert.AreEqual(61.25, a.ChanceAgreement * 100, 1e-2);
            Assert.AreEqual(0.6938, a.Kappa, 1e-4);
            Assert.AreEqual(0.0650, a.StandardErrorUnderNull, 1e-4);

            KappaTest target = new KappaTest(a);

            Assert.AreEqual(OneSampleHypothesis.ValueIsGreaterThanHypothesis, target.Hypothesis);

            Assert.AreEqual(10.67, target.Statistic, 1e-3);
            Assert.AreEqual(7.0849733798130419E-27, target.PValue);
        }