Ejemplo n.º 1
0
        public ActionResult UpdateUPparSeting()
        {
            var sr     = new StreamReader(Request.InputStream);
            var stream = sr.ReadToEnd();
            JavaScriptSerializer js = new JavaScriptSerializer();
            UpDownExperiment     upDownExperiment = ude;

            upDownExperiment.udt_Distribution = js.Deserialize <UpDownExperiment>(stream).udt_Distribution;
            var isTure = dbDrive.Update(upDownExperiment);

            double[] xArray = new double[udv.Count];
            int[]    vArray = new int[udv.Count];
            for (int i = 0; i < udv.Count; i++)
            {
                xArray[i] = udv[i].dtup_Standardstimulus;
                vArray[i] = LiftingPublic.Filp(udv[i].dtup_response, upDownExperiment.udt_Flipresponse);
            }
            var lr = LiftingPublic.SelectState(upDownExperiment);
            var up = lr.GetReturn(xArray, vArray, upDownExperiment.udt_Initialstimulus, upDownExperiment.udt_Stepd, out double z, upDownExperiment.udt_Instrumentresolution, out double z1);

            double[] prec  = lr.GetPrec(up.μ0_final, up.σ0_final);
            var      group = upDownExperiment.udt_Groupingstate == 0 ? "不分组" : "多组试验";

            double[] rpse = lr.ResponsePointStandardError(up.Sigma_mu, up.Sigma_sigma);
            string[] str  = { isTure.ToString(), up.μ0_final.ToString(), up.σ0_final.ToString(), up.Sigma_mu.ToString(), up.Sigma_sigma.ToString(), up.A.ToString(), up.M.ToString(), up.B.ToString(), up.b.ToString(), prec[1].ToString(), prec[0].ToString(), rpse[0].ToString(), rpse[1].ToString(), up.p.ToString(), up.G.ToString(), up.n.ToString(), up.H.ToString(), "升降法:" + lr.DistributionNameAndMethodStandardName() + "/" + group };//[0]表示修改状态,[1]代表修改后的试验参数
            return(Json(str));
        }
Ejemplo n.º 2
0
        public ActionResult Likelihood(double BatchConfidenceLevel, double yMin, double yMax, int Y_Axis, int intervalTypeSelection, double favg, double fsigma, int ExperimentalId, int udg_id)
        {
            UpDownExperiment       ude      = dbDrive.GetUpDownExperiment(ExperimentalId);
            List <UpDownDataTable> list_udt = dbDrive.GetUpDownDataTables(udg_id);
            var lr = LiftingPublic.SelectState(ude);

            double[] xArray = new double[list_udt.Count];
            int[]    vArray = new int[list_udt.Count];
            for (int i = 0; i < list_udt.Count; i++)
            {
                xArray[i] = list_udt[i].dtup_Initialstimulus;
                vArray[i] = LiftingPublic.Filp(list_udt[i].dtup_response, ude.udt_Flipresponse);
            }
            var srd = lr.QuasiLikelihoodRatioMethod(yMax, yMin, Y_Axis, BatchConfidenceLevel, favg, fsigma, xArray, vArray, intervalTypeSelection);

            LangleyPublic.sideReturnData = srd;
            LangleyPublic.aArray.Clear();
            LangleyPublic.bArray.Clear();
            LangleyPublic.cArray.Clear();
            double ceiling = srd.responsePoints.Min();
            double lower   = srd.responsePoints.Max();

            for (int i = 0; i < srd.responseProbability.Length; i++)
            {
                LangleyPublic.aArray.Add("[" + srd.responsePoints[i] + "," + srd.responseProbability[i] + "]");
                if (double.IsInfinity(srd.Y_Ceilings[i]))
                {
                    LangleyPublic.bArray.Add("[" + lower + "," + srd.responseProbability[i] + "]");
                }
                else
                {
                    LangleyPublic.bArray.Add("[" + srd.Y_Ceilings[i] + "," + srd.responseProbability[i] + "]");
                }
                if (double.IsInfinity(srd.Y_LowerLimits[i]))
                {
                    LangleyPublic.cArray.Add("[" + ceiling + "," + srd.responseProbability[i] + "]");
                }
                else
                {
                    LangleyPublic.cArray.Add("[" + srd.Y_LowerLimits[i] + "," + srd.responseProbability[i] + "]");
                }
            }
            if (intervalTypeSelection == 0)
            {
                LangleyPublic.incredibleIntervalType = "拟然比区间计算-单侧置信区间";
            }
            else
            {
                LangleyPublic.incredibleIntervalType = "拟然比区间计算-双侧置信区间";
            }
            LangleyPublic.incredibleLevelName = BatchConfidenceLevel.ToString();
            return(Json(true));
        }
Ejemplo n.º 3
0
        public ActionResult ResponsePointIntervalEstimation(int ExperimentalId, int udg_id, double Srb_ProbabilityResponse, double Srb_Confidencelevel, double fq, double favg, double fsigma)
        {
            List <UpDownView> list_udv         = dbDrive.GetUpDownViews(udg_id);
            UpDownExperiment  upDownExperiment = dbDrive.GetUpDownExperiment(ExperimentalId);

            double[] xArray = new double[list_udv.Count];
            int[]    vArray = new int[list_udv.Count];
            for (int i = 0; i < list_udv.Count; i++)
            {
                xArray[i] = list_udv[i].dtup_Initialstimulus;
                vArray[i] = LiftingPublic.Filp(list_udv[i].dtup_response, upDownExperiment.udt_Flipresponse);
            }
            var ies = LiftingPublic.SelectState(upDownExperiment).ResponsePointIntervalEstimated(Srb_ProbabilityResponse, Srb_Confidencelevel, xArray, vArray, fq, favg, fsigma);

            string[] str = { "(" + ies[0].Confidence.Down.ToString("f6") + "," + ies[0].Confidence.Up.ToString("f6") + ")", "(" + ies[0].Mu.Down.ToString("f6") + "," + ies[0].Mu.Up.ToString("f6") + ")", "(" + ies[0].Sigma.Down.ToString("f6") + "," + ies[0].Sigma.Up.ToString("f6") + ")", "(" + ies[1].Confidence.Down.ToString("f6") + "," + ies[1].Confidence.Up.ToString("f6") + ")", "(" + ies[1].Mu.Down.ToString("f6") + "," + ies[1].Mu.Up.ToString("f6") + ")", "(" + ies[1].Sigma.Down.ToString("f6") + "," + ies[1].Sigma.Up.ToString("f6") + ")" };
            return(Json(str));
        }