Accord.Tests.Statistics.EmpiricalHazardDistributionTest.LeukemiaExample_KaplanMeier C# (CSharp) Method

LeukemiaExample_KaplanMeier() private method

private LeukemiaExample_KaplanMeier ( ) : void
return void
        public void LeukemiaExample_KaplanMeier()
        {
            // The following are times of remission (weeks) for 21 leukemia
            // patients receiving control treatment (Table 1.1 of Cox & Oakes):
            // http://www-personal.umich.edu/~yili/lect2notes.pdf

            double[] t = { 1, 1, 2, 2, 3, 4, 4, 5, 5, 8, 8, 8, 8, 11, 11, 12, 12, 15, 17, 22, 23 };


            var distribution = new EmpiricalHazardDistribution(SurvivalEstimator.KaplanMeier);

            distribution.Fit(t, new EmpiricalHazardOptions { Estimator = HazardEstimator.KaplanMeier });

            Assert.AreEqual(1, distribution.Survivals[0]);
            Assert.AreEqual(0.905, distribution.Survivals[1], 1e-3);
            Assert.AreEqual(0.809, distribution.Survivals[2], 1e-3);
            Assert.AreEqual(0.762, distribution.Survivals[3], 1e-3);

            /*
             http://statpages.org/prophaz2.html
                1, 1 
                1, 1 
                2, 1 
                2, 1
                3, 1
                4, 1
                4, 1
                5, 1
                5, 1 
                8, 1 
                8, 1 
                8, 1 
                8, 1 
                11, 1
                11, 1 
                12, 1 
                12, 1 
                15, 1 
                17, 1 
                22, 1 
                23, 1
             */
        }