Exemplo n.º 1
0
        static public double StudentQuantile(double alf, int m)
        {
            double T     = 0;
            double u_alf = Math.Abs(Distributions.NormalQuantile(alf /*1 - 0.05 / 2*/));
            double g1    = (Math.Pow(u_alf, 3) + u_alf) / 4;
            double g2    = (5 * Math.Pow(u_alf, 5) + 16 * Math.Pow(u_alf, 3) + 3 * u_alf) / 96;
            double g3    = (34 * Math.Pow(u_alf, 7) + 19 * Math.Pow(u_alf, 5) + 17 * Math.Pow(u_alf, 3) - 15 * u_alf) / 384;
            double g4    = (79 * Math.Pow(u_alf, 9) + 779 * Math.Pow(u_alf, 7) + 1482 * Math.Pow(u_alf, 5) - 1920 * Math.Pow(u_alf, 3) - 945 * u_alf) / 92160;

            T = u_alf + g1 / (m) + g2 / Math.Pow(m, 2) + g3 / Math.Pow(m, 3) + g4 / Math.Pow(m, 4);
            return(T);
        }
Exemplo n.º 2
0
        private void UppperValueToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool[] KTurnOn = KTurnOnFound();
            int    w       = 0;

            foreach (bool b in KTurnOn)
            {
                if (!b)
                {
                    w++;
                }
            }
            double[,] SubK = InitialAnalysMultidimensionalData.SubK(IAM.K, KTurnOn);

            double[,] V2 = new double[SubK.GetLength(0), SubK.GetLength(1)];
            double[,] BV = new double[SubK.GetLength(0), SubK.GetLength(1)];
            double U = Distributions.NormalQuantile(1 - IAM.ISA[0].alf.Q / 2);

            U /= (IAM.N - w - 3);
            for (int col = 0; col < SubK.GetLength(1); col++)
            {
                for (int row = 0; row < SubK.GetLength(0); row++)
                {
                    if (KTurnOn[col] && KTurnOn[row])
                    {
                        V2[row, col] = Math.Log((1 + SubK[row, col]) / (1 - SubK[row, col])) / 2 + U;
                        double exp = Math.Exp(2 * V2[row, col]);
                        if (double.IsInfinity(exp))
                        {
                            BV[row, col] = 1;
                        }
                        else
                        {
                            BV[row, col] = (exp - 1.0) / (exp + 1.0);
                        }
                    }
                }
            }
            WraitK(CorelDataGridView, BV, KTurnOn);
        }
        public void Refresh()
        {
            Min.Q = l[0];
            Max.Q = l[l.Count - 1];
            Len.Q = Max.Q - Min.Q;
            T     = Distributions.StudentQuantile(alf.Q / 2, (int)m.Q - 1);
            f     = new List <double>();
            Y2    = new List <double>();
            F     = new List <double>();
            if (l[l.Count - 1] - l[0] == 0)
            {
                Step.Q = 1;
            }
            else
            {
                Step.Q = 1.0001 * ((l[l.Count - 1] - l[0]) / m.Q);
            }
            MxFound(l);
            DxFound();
            X_2.Q     = StartMoment(l, 2);
            Mx_rang.Q = Mx.Q - (l[0] + l[l.Count - 1]) / l.Count;
            Mediana.Q = MEDFound(l);
            MADFound();
            MODFound();
            CoefEcscecFound(l);
            CoefAsimFound(l);
            QuantileFound();
            //AverYolshaFound();
            CutData();
            CoefVarPirson.Q = Gx.Q / Mx.Q;
            W.Q             = MAD.Q / Mediana.Q;
            PredictionintervalFound(l);
            A             = Mx.Q - Math.Sqrt(3 * (X_2.Q - Mx.Q * Mx.Q));
            B             = Mx.Q + Math.Sqrt(3 * (X_2.Q - Mx.Q * Mx.Q));
            KrAbbe.Q      = KrAbbeFound(l, unsortl);
            KrAbbe.QKvant = Distributions.NormalQuantile(1 - alf.Q / 2);

            DataRound();
        }
Exemplo n.º 4
0
        double KrZnakivFound(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            double        S  = 0;
            double        hN = gr1.l.Count;
            List <double> Z  = new List <double>();

            for (int i = 0; i < gr1.l.Count && i < gr2.l.Count; i++)
            {
                Z.Add(gr1.unsortl[i] - gr2.unsortl[i]);
                if (gr1.unsortl[i] - gr2.unsortl[i] > 0)
                {
                    S++;
                }
                if (gr1.unsortl[i] - gr2.unsortl[i] == 0)
                {
                    hN--;
                }
            }
            if (hN <= 15)
            {
                double alf0 = 0;
                for (int i = 0; i <= hN - S; i++)
                {
                    alf0 += CFound(i, hN);
                }
                alf0       *= Math.Pow(2, -hN);
                KrZnakiv[1] = gr1.alf.Q;
                return(alf0);
            }
            else
            {
                double Sn = (S - 0.5 - hN / 2) / Math.Sqrt(hN / 4);
                KrZnakiv[1] = Distributions.NormalQuantile(1 - gr1.alf.Q / 2);
                return(Sn);
            }
        }
Exemplo n.º 5
0
        public UniformityCriteria(List <InitialStatisticalAnalys> ML, List <int> MSelectGR)
        {
            this.ML        = ML;
            this.MSelectGR = MSelectGR;

            N = NFound(ML, MSelectGR);
            {
                double NezCount = ML[MSelectGR[0]].l.Count;
                for (int i = 0; i < MSelectGR.Count; i++)
                {
                    if (ML[MSelectGR[i]].l.Count != NezCount)
                    {
                        Nezal = false;
                    }
                }
            }
            rDvomFound(ML[MSelectGR[0]].unsortl);
            r            = rFound(ML, MSelectGR);
            Sm2          = Sm2Found(ML, MSelectGR);
            Sv2          = Sv2Found(ML, MSelectGR);
            VarSv2Sm2[0] = Sm2 / Sv2;
            VarSv2Sm2[1] = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1, (int)(N - MSelectGR.Count));
            var tyui = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, 10, 10);

            if (Nezal == true)
            {
                KrKohrena[0] = KrKohrenaFound(ML, MSelectGR);
                KrKohrena[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1);
                T            = Distributions.StudentQuantile(1 - ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2);
            }
            if (MSelectGR.Count == 2)
            {
                Doubl = true;
                if (Nezal == true)
                {
                    SravnSred[1] = Distributions.StudentQuantile(ML[MSelectGR[0]].alf.Q / 2,
                                                                 ML[MSelectGR[0]].l.Count + ML[MSelectGR[1]].l.Count - 2);
                }
                else
                {
                    SravnSred[1] = Distributions.StudentQuantile(ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2);
                }

                SravnSred[0]   = SimpleMx(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                SravnDisper[0] = SimpleS(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                SravnDisper[1] = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, ML[MSelectGR[0]].l.Count - 1, ML[MSelectGR[1]].l.Count - 1);

                KrSmirnKolmag[0] = 1.0 - LzFound(ZFound(ML[MSelectGR[0]], ML[MSelectGR[1]]));
                KrSmirnKolmag[1] = ML[MSelectGR[0]].alf.Q;

                KrsumRangVils[0] = KrsumRangVilsFound(r, ML[MSelectGR[0]], ML[MSelectGR[1]]);
                KrsumRangVils[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0);

                KrUMannaUit[0] = KrUMannaUitFound(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                KrUMannaUit[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0);

                RizSerRangVib[0] = RizSerRangVibFound(r, ML[MSelectGR[0]], ML[MSelectGR[1]]);
                RizSerRangVib[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0);

                KrZnakiv[0] = KrZnakivFound(ML[MSelectGR[0]], ML[MSelectGR[1]]);
            }
            else
            {
                Doubl          = false;
                SravnSred[0]   = SimpleMx(ML, MSelectGR);
                SravnDisper[0] = SimpleS(ML, MSelectGR);
                SravnDisper[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1);

                KrKruskalaUolisa[0] = KrKruskalaUolisaFound(r, ML, MSelectGR);
                KrKruskalaUolisa[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1);
            }
            Round();
        }
        public Correlation_RegressionAnalysis(List <InitialStatisticalAnalys> ML, List <int> MSelectGR, string RegresTypeVib)
        {
            this.ML            = ML;
            this.MSelectGR     = MSelectGR;
            this.RegresTypeVib = RegresTypeVib;

            N = NFound(ML, MSelectGR);
            {
                double NezCount = ML[MSelectGR[0]].l.Count;
                for (int i = 0; i < MSelectGR.Count; i++)
                {
                    if (ML[MSelectGR[i]].l.Count != NezCount)
                    {
                        Nezal = false;
                    }
                }
            }
            T = Distributions.StudentQuantile(1 - ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2);
            if (MSelectGR.Count == 2)
            {
                Doubl = true;
                if (Nezal == true)
                {
                    f                   = fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], 15, 7);
                    Korelation[0]       = KorelationFound(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                    KorelationVidnoh[0] = KorelationVidnohFound(ML, MSelectGR);
                    RangKorelation[0]   = RangKorelationFound(ML, MSelectGR);
                    RangKorelation[1]   = RangKorelation[0] * Math.Sqrt((ML[MSelectGR[0]].l.Count - 2) / (1 - Math.Pow(RangKorelation[0], 2)));


                    X2f[0] = X2fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], f);
                    X2f[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, ML[MSelectGR[0]].l.Count - 2);

                    RangKoefKend[0] = RangKoefKendFound(ML, MSelectGR);//slow
                    RangKoefKend[1] = 3 * RangKoefKend[0] * Math.Sqrt((ML[MSelectGR[0]].l.Count * (ML[MSelectGR[0]].l.Count - 1)) /
                                                                      (2 * (2 * ML[MSelectGR[0]].l.Count + 5)));
                    RangKoefKend[2] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2);

                    Nij = NijFound(ML, MSelectGR);
                    int ti = (int)(12 * ML[MSelectGR[1]].Dx.Q / ML[MSelectGR[0]].Dx.Q);
                    try
                    {
                        if (Math.Abs(ti) > 20)
                        {
                            ti = 20;
                        }
                    }
                    catch
                    { ti = 20; }
                    TablPerTab(ML, MSelectGR, fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], 12, ti));

                    Q    = RegresParamFound(ML[MSelectGR[0]], ML[MSelectGR[1]], Korelation[0], RegresTypeVib, ref Szal2);
                    Szal = SzalF(ML[MSelectGR[0]], ML[MSelectGR[1]], Q, RegresTypeVib);/*
                                                                                        * AB[1] = Korelation[0] * ML[MSelectGR[1]].Gx.Q / ML[MSelectGR[0]].Gx.Q;
                                                                                        * AB[0] = ML[MSelectGR[1]].Mx.Q - AB[1] * ML[MSelectGR[0]].Mx.Q;*/
                    NachYslovRegAnal(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                    // Szal = SzalFound(AB, ML[MSelectGR[0]], ML[MSelectGR[1]]);

                    /*AB[2] = Szal * Math.Sqrt(1.0 / ML[MSelectGR[0]].l.Count + Math.Pow(ML[MSelectGR[0]].Mx.Q, 2) /
                     *  (ML[MSelectGR[0]].Dx.Q * (ML[MSelectGR[0]].l.Count - 1)));
                     * AB[3] = Szal / (ML[MSelectGR[0]].Gx.Q * Math.Sqrt(ML[MSelectGR[0]].l.Count - 1));*/


                    ABTailFound(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                    double op = Korelation[0] * (1 - Math.Pow(Korelation[0], 2)) / (2 * ML[MSelectGR[0]].l.Count);
                    double oi = (1 - Math.Pow(Korelation[0], 2)) / Math.Sqrt(ML[MSelectGR[0]].l.Count - 1);
                    double rn = Korelation[0] + op - Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2) * oi;
                    double rv = Korelation[0] + op + Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2) * oi;
                    if (rn < -1)
                    {
                        rn = 1;
                    }
                    if (rv > 1)
                    {
                        rv = 1;
                    }
                    Korelation[1] = rn;
                    Korelation[2] = rv;
                    Korelation[3] = op;
                    if (RegresTypeVib == RegresTypeName.ParabRegresion)
                    {
                        KoefDeterm = (1 - Math.Pow(Szal2, 2) / ML[MSelectGR[1]].Dx.Q) * 100;
                    }
                    else
                    {
                        KoefDeterm = Math.Pow(Korelation[0], 2) * 100;
                    }
                }
            }
            else
            {
                Doubl = false;
            }
            Round();
        }
Exemplo n.º 7
0
        public SimpleClass(List <InitialStatisticalAnalys> ML, List <int> MSelectGR, double BinSim)
        {
            this.ML        = ML;
            this.MSelectGR = MSelectGR;

            N     = NFound(ML, MSelectGR);
            Nezal = Nezalegni();

            r            = rFound(ML, MSelectGR);
            Sm2          = Sm2Found(ML, MSelectGR);
            Sv2          = Sv2Found(ML, MSelectGR);
            VarSv2Sm2[0] = Sm2 / Sv2;
            VarSv2Sm2[1] = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1, (int)(N - MSelectGR.Count));
            var tyui = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, 10, 10);

            if (Nezal == true)
            {
                KrKohrena[0] = KrKohrenaFound(ML, MSelectGR, BinSim);
                KrKohrena[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1);
                T            = Distributions.StudentQuantile(1 - ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2);
            }
            if (MSelectGR.Count == 2)
            {
                Doubl = true;
                if (Nezal == true)
                {
                    f                   = fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], 15, 7);
                    Korelation[0]       = KorelationFound(ML, MSelectGR);
                    KorelationVidnoh[0] = KorelationVidnohFound(ML, MSelectGR);
                    RangKorelation[0]   = RangKorelationFound(ML, MSelectGR);
                    RangKorelation[1]   = RangKorelation[0] * Math.Sqrt((ML[MSelectGR[0]].l.Count - 2) / (1 - Math.Pow(RangKorelation[0], 2)));


                    X2f[0] = X2fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], f);
                    X2f[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, ML[MSelectGR[0]].l.Count - 2);

                    RangKoefKend[0] = RangKoefKendFound(ML, MSelectGR);//slow
                    RangKoefKend[1] = 3 * RangKoefKend[0] * Math.Sqrt((ML[MSelectGR[0]].l.Count * (ML[MSelectGR[0]].l.Count - 1)) /
                                                                      (2 * (2 * ML[MSelectGR[0]].l.Count + 5)));
                    RangKoefKend[2] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2);

                    Nij = NijFound(ML, MSelectGR, BinSim);
                    int ti = (int)(12 * ML[MSelectGR[1]].Dx.Q / ML[MSelectGR[0]].Dx.Q);
                    try
                    {
                        if (Math.Abs(ti) > 20)
                        {
                            ti = 20;
                        }
                    }
                    catch
                    { ti = 20; }
                    TablPerTab(ML, MSelectGR, fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], 12, ti));

                    RegresParam = RegresParamFound();
                    NachYslovRegAnal(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                    KoefDeterm = Math.Pow(Korelation[0], 2) * 100;
                    Szal       = SzalFound(AB, ML[MSelectGR[0]], ML[MSelectGR[1]]);
                    AB[2]      = Szal * Math.Sqrt(1.0 / ML[MSelectGR[0]].l.Count + Math.Pow(ML[MSelectGR[0]].Mx.Q, 2) /
                                                  (ML[MSelectGR[0]].Dx.Q * (ML[MSelectGR[0]].l.Count - 1)));
                    AB[3] = Szal / (ML[MSelectGR[0]].Gx.Q * Math.Sqrt(ML[MSelectGR[0]].l.Count - 1));

                    ABTailFound(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                    double op = Korelation[0] * (1 - Math.Pow(Korelation[0], 2)) / (2 * ML[MSelectGR[0]].l.Count);
                    double oi = (1 - Math.Pow(Korelation[0], 2)) / Math.Sqrt(ML[MSelectGR[0]].l.Count - 1);
                    double rn = Korelation[0] + op - Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2) * oi;
                    double rv = Korelation[0] + op + Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2) * oi;
                    if (rn < -1)
                    {
                        rn = 1;
                    }
                    if (rv > 1)
                    {
                        rv = 1;
                    }
                    Korelation[1] = rn;
                    Korelation[2] = rv;
                    Korelation[2] = op;
                    SravnSred[1]  = Distributions.StudentQuantile(ML[MSelectGR[0]].alf.Q / 2,
                                                                  ML[MSelectGR[0]].l.Count + ML[MSelectGR[1]].l.Count - 2);
                }
                else
                {
                    SravnSred[1] = Distributions.StudentQuantile(ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2);
                }

                SravnSred[0]   = SimpleMx(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                SravnDisper[0] = SimpleS(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                SravnDisper[1] = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, ML[MSelectGR[0]].l.Count - 1, ML[MSelectGR[1]].l.Count - 1);

                KrSmirnKolmag[0] = 1.0 - LzFound(ZFound(ML[MSelectGR[0]], ML[MSelectGR[1]]));
                KrSmirnKolmag[1] = ML[MSelectGR[0]].alf.Q;

                KrsumRangVils[0] = KrsumRangVilsFound(r, ML[MSelectGR[0]], ML[MSelectGR[1]]);
                KrsumRangVils[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0);

                KrUMannaUit[0] = KrUMannaUitFound(ML[MSelectGR[0]], ML[MSelectGR[1]]);
                KrUMannaUit[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0);

                RizSerRangVib[0] = RizSerRangVibFound(r, ML[MSelectGR[0]], ML[MSelectGR[1]]);
                RizSerRangVib[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0);

                KrZnakiv[0] = KrZnakivFound(ML[MSelectGR[0]], ML[MSelectGR[1]]);
            }
            else
            {
                Doubl          = false;
                SravnSred[0]   = SimpleMx(ML, MSelectGR);
                SravnDisper[0] = SimpleS(ML, MSelectGR);
                SravnDisper[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1);

                KrKruskalaUolisa[0] = KrKruskalaUolisaFound(r, ML, MSelectGR);
                KrKruskalaUolisa[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1);
            }
            Round();
        }