public void Test1()
        {
            var pc         = new CDF(_samples);
            var percentile = pc.Calculate(999);

            Assert.Equal(0, percentile);
        }
        public void Test3()
        {
            var pc         = new CDF(_samples);
            var percentile = pc.Calculate(1001);

            Assert.Equal(1, percentile);
        }
Example #3
0
        public IActionResult OnGet()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var samples = GetSamples();

            var cdf = new CDF(samples);

            Percentile = cdf.Calculate(GetRandomVariable());

            var cdfInv = new InverseCDF(samples);

            const double eps = .0001;

            for (var perc = 0.0; perc <= .95 + eps; perc += .05)
            {
                var inv = cdfInv.Calculate(perc);
                Percentiles.Add(inv);
                XAxis.Add(Convert.ToInt32(perc * 100));
            }

            return(Page());
        }