private Data SravSredF(List <InitialAnalysMultidimensionalData> IAMD)
        {
            Data rez = new Data()
            {
                Name = "Збіг середніх при розбіжності DC"
            };

            double[,] Ex = ExF(IAMD);
            double[,] V  = new double[1, 1];
            for (int d = 0; d < IAMD.Count; d++)
            {
                double[,] Exd = xdF(IAMD[d]);
                double[,] Xdx = new double[1, n];
                for (int i = 0; i < n; i++)
                {
                    Xdx[0, i] = Exd[0, i] - Ex[0, i];
                }
                double[,] SInv = Matrix.InverseMatrix(SdF(IAMD[d]));
                V = Matrix.Addition(V, Matrix.MultiplicMatrix(Xdx, Matrix.MultiplicMatrix(SInv, Matrix.TranspMatrix(Xdx))));
            }
            rez.Q      = V[0, 0];
            rez.QKvant = Hi.HIF(IAMD[0].ISA[0].alf.Q, (int)(n * (IAMD.Count - 1)));
            rez.H      = rez.Q <= rez.QKvant;
            return(rez);
        }
        private Data SravnDisperF(List <InitialAnalysMultidimensionalData> IAMD)
        {
            Data rez = new Data()
            {
                Name = "Збіг DC"
            };
            double Nsum = N.Sum();
            double V    = 0;

            double[,] S = new double[n, n];
            List <double[, ]> Sd = new List <double[, ]>();

            for (int d = 0; d < IAMD.Count; d++)
            {
                Sd.Add(SdF(IAMD[d]));
            }
            for (int d = 0; d < IAMD.Count; d++)
            {
                S = Matrix.Addition(S, Matrix.MultiplicNumber(Sd[d], N[d] - 1));
            }
            S = Matrix.MultiplicNumber(S, 1.0 / (Nsum - IAMD.Count));

            double detS = Matrix.Determinant(S);

            for (int d = 0; d < IAMD.Count; d++)
            {
                V += ((N[d] - 1) / 2) * Math.Log(detS / Matrix.Determinant(Sd[d]));
            }
            rez.Q      = V;
            rez.QKvant = Hi.HIF(IAMD[0].ISA[0].alf.Q, n * (n + 1) * (IAMD.Count - 1) / 2);
            rez.H      = rez.Q <= rez.QKvant;
            return(rez);
        }
Пример #3
0
        public Data SravnSredF(InitialAnalysMultidimensionalData X, InitialAnalysMultidimensionalData Y)
        {
            Data rez = new Data();

            double[,] S0 = S0F(X, Y);
            double[,] S1 = S1F(X, Y);
            rez.Name     = "Рівність багатомірних середніх при рівності DC матриці";
            rez.Q        = -(N1 + N2 - 2 - n / 2) * Math.Log(Matrix.Determinant(S1) / Matrix.Determinant(S0));
            rez.QKvant   = Hi.HIF(X.ISA[0].alf.Q, n);
            rez.H        = rez.Q <= rez.QKvant;
            return(rez);
        }
Пример #4
0
        double[,] NijFound(List <InitialStatisticalAnalys> ML, List <int> MSelectGR, double BinSim)
        {
            double[,] rez = new double[3, 3];
            for (int i = 0; i < ML[MSelectGR[0]].l.Count; i++)
            {
                if (ML[MSelectGR[0]].unsortl[i] > BinSim && ML[MSelectGR[1]].unsortl[i] > BinSim)
                {
                    rez[1, 1]++;
                }
                else if (ML[MSelectGR[0]].unsortl[i] > BinSim && ML[MSelectGR[1]].unsortl[i] <= BinSim)
                {
                    rez[0, 1]++;
                }
                else if (ML[MSelectGR[0]].unsortl[i] <= BinSim && ML[MSelectGR[1]].unsortl[i] > BinSim)
                {
                    rez[1, 0]++;
                }
                else if (ML[MSelectGR[0]].unsortl[i] <= BinSim && ML[MSelectGR[1]].unsortl[i] <= BinSim)
                {
                    rez[0, 0]++;
                }
            }
            rez[2, 0] = rez[0, 0] + rez[0, 1];                         ///N0
            rez[2, 1] = rez[1, 0] + rez[1, 1];                         ///N1
            rez[0, 2] = rez[0, 0] + rez[1, 0];                         ///M0
            rez[1, 2] = rez[0, 1] + rez[1, 1];                         ///M1
            rez[2, 2] = rez[0, 0] + rez[0, 1] + rez[1, 0] + rez[1, 1]; ///N
            double V = rez[0, 0] + rez[1, 1];
            double W = rez[0, 1] + rez[1, 0];

            IndexFehnera     = (V - W) / (V + W);
            KoefSpolF[0]     = (rez[0, 0] * rez[1, 1] - rez[0, 1] * rez[1, 0]) / Math.Sqrt(rez[0, 2] * rez[1, 2] * rez[2, 0] * rez[2, 1]);
            KoefSpolF[1]     = Math.Pow(KoefSpolF[0], 2) * ML[MSelectGR[0]].l.Count;
            KoefSpolF[2]     = Hi.HIF(ML[MSelectGR[1]].alf.Q, 1);
            KoefSvazYoola[0] = (rez[0, 0] * rez[1, 1] - rez[0, 1] * rez[1, 0]) / (rez[0, 0] * rez[1, 1] + rez[0, 1] * rez[1, 0]);
            KoefSvazYoola[1] = (Math.Sqrt(rez[0, 0] * rez[1, 1]) - Math.Sqrt(rez[0, 1] * rez[1, 0])) /
                               (Math.Sqrt(rez[0, 0] * rez[1, 1]) + Math.Sqrt(rez[0, 1] * rez[1, 0]));
            KoefSvazYoola[2] = KoefSvazYoola[0] / (Math.Sqrt(1.0 / rez[0, 0] + 1.0 / rez[1, 0] + 1.0 / rez[0, 1] + 1.0 / rez[1, 1]) *
                                                   (1 - Math.Pow(KoefSvazYoola[0], 2)) / 2.0);
            KoefSvazYoola[3] = KoefSvazYoola[1] / (Math.Sqrt(1.0 / rez[0, 0] + 1.0 / rez[1, 0] + 1.0 / rez[0, 1] + 1.0 / rez[1, 1]) *
                                                   (1 - Math.Pow(KoefSvazYoola[1], 2)) / 4.0);
            return(rez);
        }
Пример #5
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();
        }
Пример #6
0
        void TablPerTab(List <InitialStatisticalAnalys> ML, List <int> MSelectGR, double[,] f)
        {
            double[] n = new double[f.GetLength(1)];
            double[] m = new double[f.GetLength(0)];
            for (int i = 0; i < f.GetLength(0); i++)
            {
                for (int j = 0; j < f.GetLength(1); j++)
                {
                    m[i] += f[i, j] * ML[MSelectGR[0]].l.Count;
                }
            }
            for (int i = 0; i < f.GetLength(1); i++)
            {
                for (int j = 0; j < f.GetLength(0); j++)
                {
                    n[i] += f[j, i] * ML[MSelectGR[1]].l.Count;
                }
            }
            for (int i = 0; i < f.GetLength(1); i++)
            {
                for (int j = 0; j < f.GetLength(0); j++)
                {
                    NezXY[0] += Math.Pow(f[j, i] * ML[MSelectGR[0]].l.Count - n[i] * m[j] / ML[MSelectGR[0]].l.Count, 2) / (n[i] * m[j] / ML[MSelectGR[0]].l.Count);
                }
            }
            NezXY[1]        = Hi.HIF(ML[MSelectGR[0]].alf.Q, (f.GetLength(1) - 1) * (f.GetLength(0) - 1));
            KoefSpolPirs[0] = Math.Sqrt(NezXY[0] / (NezXY[0] + ML[MSelectGR[0]].l.Count));

            double P = 0, Q = 0;
            double Stsig = 0;

            for (int i = 0; i < f.GetLength(1); i++)
            {
                for (int j = 0; j < f.GetLength(0); j++)
                {
                    double t1 = 0, t2 = 0, A1 = 0, B1 = 0, A2 = 0, B2 = 0;
                    for (int k = i; k < f.GetLength(1); k++)
                    {
                        for (int l = j; l < f.GetLength(0); l++)
                        {
                            t1 += f[l, k] * ML[MSelectGR[1]].l.Count;
                            A1 += f[l, k] * ML[MSelectGR[1]].l.Count;
                            A2 += f[l - j, k - i] * ML[MSelectGR[1]].l.Count;
                            B1 += f[l, k - i] * ML[MSelectGR[1]].l.Count;
                            B2 += f[l - j, k] * ML[MSelectGR[1]].l.Count;
                        }
                        for (int l = 0; l < j; l++)
                        {
                            t2 += f[l, k] * ML[MSelectGR[1]].l.Count;
                        }
                    }
                    P     += f[j, i] * t1 * ML[MSelectGR[1]].l.Count;
                    Q     += f[j, i] * t2 * ML[MSelectGR[1]].l.Count;
                    Stsig += f[j, i] * ML[MSelectGR[1]].l.Count * Math.Pow(A1 + A2 - B1 - B2, 2);
                }
            }
            if (f.GetLength(0) == f.GetLength(1))
            {
                MeraZvazKendallaStatStyardName = "Міра зв'язку Кендалла";
                double T1 = 0, T2 = 0;
                for (int j = 0; j < f.GetLength(1); j++)
                {
                    T1 += n[j] * (n[j] - 1);
                }
                for (int j = 0; j < f.GetLength(0); j++)
                {
                    T2 += m[j] * (m[j] - 1);
                }
                T1 /= 2;
                T2 /= 2;
                MeraZvazKendallaStatStyard[0] = (P - Q) / Math.Sqrt((ML[MSelectGR[1]].l.Count * (ML[MSelectGR[1]].l.Count - 1) / 2.0 - T1) *
                                                                    (ML[MSelectGR[1]].l.Count * (ML[MSelectGR[1]].l.Count - 1) / 2.0 - T2));
                MeraZvazKendallaStatStyard[1] = Math.Sqrt((f.GetLength(1) * 4.0 + 10) / (9.0 * (Math.Pow(f.GetLength(1), 2) - f.GetLength(1))));
            }
            else
            {
                MeraZvazKendallaStatStyardName = "Статистика Стюарда";
                MeraZvazKendallaStatStyard[0]  = 2 * (P - Q) * Math.Min(f.GetLength(0), f.GetLength(1)) /
                                                 (Math.Pow(ML[MSelectGR[1]].l.Count, 2) * (Math.Min(f.GetLength(0), f.GetLength(1)) - 1));
                MeraZvazKendallaStatStyard[1] = 2 * Math.Min(f.GetLength(0), f.GetLength(1)) *
                                                Math.Sqrt(Math.Pow(ML[MSelectGR[1]].l.Count, 2) * Stsig - 4.0 * ML[MSelectGR[1]].l.Count * (P - Q)) /
                                                (Math.Pow(ML[MSelectGR[1]].l.Count, 3) * (Math.Min(f.GetLength(0), f.GetLength(1)) - 1));
            }
            double RKS = 0;

            for (int i = 0; i < f.GetLength(1); i++)
            {
                for (int j = 0; j < f.GetLength(0); j++)
                {
                    double S1 = 0, S2 = 0;
                    for (int k = 0; k < i; k++)
                    {
                        S1 += 1.5 * n[k];
                    }
                    for (int l = 0; l < j; l++)
                    {
                        S2 += 1.5 * m[l];
                    }
                    RKS += f[j, i] * ML[MSelectGR[1]].l.Count * (S1 - ML[MSelectGR[1]].l.Count / 2.0) * (S2 - ML[MSelectGR[1]].l.Count / 2.0);
                }
            }

            double Mi = 0, Ni = 0;

            for (int i = 0; i < f.GetLength(1); i++)
            {
                Ni += Math.Pow(n[i], 3) - n[i];
            }

            for (int i = 0; i < f.GetLength(0); i++)
            {
                Mi += Math.Pow(m[i], 3) - m[i];
            }
            KoefRKorSpir[0] = 12.0 * RKS / Math.Sqrt((Math.Pow(ML[MSelectGR[1]].l.Count, 3) - f.GetLength(1) - Ni) *
                                                     (Math.Pow(ML[MSelectGR[1]].l.Count, 3) - f.GetLength(1) - Mi));
            KoefRKorSpir[1] = (1 - Math.Pow(KoefRKorSpir[0], 2)) / (Math.Sqrt(ML[MSelectGR[1]].l.Count - 2));
        }
Пример #7
0
        private bool NachYslovRegAnal(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            AB[1] = Korelation[0] * gr2.Gx.Q / gr1.Gx.Q;
            AB[0] = gr2.Mx.Q - AB[1] * gr1.Mx.Q;
            bool rez = true;

            if (!(gr1.AvtoType == gr2.AvtoType && gr2.AvtoType == "Нормальний"))
            {
                rez = false;
            }
            int M = 18;

            List <double>[] yi = new List <double> [M];
            for (int i = 0; i < M; i++)
            {
                yi[i] = new List <double>();
            }
            for (int i = 0; i < ML[MSelectGR[0]].l.Count; i++)
            {
                for (int j = 0; j < M; j++)
                {
                    if (gr1.unsortl[i] < (j + 1.0001) * gr1.Len.Q / M + gr1.Min.Q && gr1.unsortl[i] >= (j * gr1.Len.Q / M + gr1.Min.Q))
                    {
                        yi[j].Add(gr2.unsortl[i]);
                        break;
                    }
                }
            }
            ///ProvRegr
            double t1 = 0, t2 = 0;

            ///


            double[] Sxj = new double[M];
            double   S   = 0;

            for (int i = 0; i < M; i++)
            {
                double ysr = yi[i].Sum() / yi[i].Count;
                if (ysr > 0)
                {
                    for (int j = 0; j < yi[i].Count; j++)
                    {
                        t2     += Math.Pow(yi[i][j] - ysr, 2);
                        Sxj[i] += Math.Pow(yi[i][j] - ysr, 2);
                    }
                    if (yi[i].Count > 1)
                    {
                        Sxj[i] /= yi[i].Count - 1;
                    }
                    t1 += yi[i].Count * Math.Pow(ysr - AB[0] - AB[1] * ((i + 0.5) * gr1.Len.Q / M + gr1.Min.Q), 2);
                }
            }
            ProvRegrs[0] = (gr1.l.Count - M) * t1 / ((M - 1) * t2);
            ProvRegrs[1] = Distributions.FisherQuantile(gr1.alf.Q, M - 1, gr1.l.Count - M);

            double C = 0;

            for (int i = 0; i < M; i++)
            {
                S += (yi[i].Count - 1) * Sxj[i];
                if (yi[i].Count != 0)
                {
                    C += 1.0 / yi[i].Count - 1.0 / gr1.l.Count;
                }
            }
            S /= gr1.l.Count - M;
            //C -= 1 / gr1.l.Count;
            C /= 3.0 * (M - 1);
            C++;
            for (int i = 0; i < M; i++)
            {
                if (Sxj[i] != 0)
                {
                    KriterBarkleta[0] += yi[i].Count * Math.Log(Sxj[i] / S);
                }
            }
            KriterBarkleta[0] /= -C;
            KriterBarkleta[1]  = Hi.HIF(gr1.alf.Q, M - 1);



            return(rez);
        }
Пример #8
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();
        }