Пример #1
0
        public ActionResult Contrast(FormCollection form)
        {
            ViewBag.SSA       = form.GetValues("ssa").Select(x => double.Parse(x)).FirstOrDefault();
            ViewBag.SSE       = form.GetValues("sse").Select(x => double.Parse(x)).FirstOrDefault();
            ViewBag.Ftest     = form.GetValues("ftest").Select(x => double.Parse(x)).FirstOrDefault();
            ViewBag.Sc        = form.GetValues("Sc").Select(x => double.Parse(x)).FirstOrDefault();
            ViewBag.n         = form.GetValues("n").Select(x => int.Parse(x)).FirstOrDefault();
            ViewBag.k         = form.GetValues("k").Select(x => int.Parse(x)).FirstOrDefault();
            ViewBag.Alt1      = form.GetValues("alt1").Select(x => int.Parse(x)).FirstOrDefault();
            ViewBag.Alt2      = form.GetValues("alt2").Select(x => int.Parse(x)).FirstOrDefault();
            ViewBag.Certainty = form.GetValues("certainty").Select(x => double.Parse(x)).FirstOrDefault();

            string alts = form.GetValues("alts").FirstOrDefault();

            ViewBag.alts = alts.Split(',').Select(x => double.Parse(x)).ToArray();

            double c     = ViewBag.alts[ViewBag.Alt1 - 1] - ViewBag.alts[ViewBag.Alt2 - 1];
            var    tdist = new TDistribution(ViewBag.k * (ViewBag.n - 1));
            double alpha = 1 - ViewBag.Certainty;
            double div   = tdist.InverseCDF(1 - alpha / 2) * ViewBag.Sc;

            ViewBag.LowLimit  = c - div;
            ViewBag.HighLimit = c + div;

            return(View("Result"));
        }