예제 #1
0
        double SimpleMx(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            if (gr1.l.Count != gr2.l.Count)
            {
                if (gr1.l.Count + gr2.l.Count <= 25)
                {
                    double A = gr1.Mx.Q - gr2.Mx.Q;
                    double B = Math.Sqrt((gr1.l.Count * gr2.l.Count) / (gr1.l.Count + gr2.l.Count));
                    double C = (gr1.l.Count - 1) * gr1.Dx.Q + (gr2.l.Count - 1) * gr2.Dx.Q;
                    C /= gr1.l.Count + gr2.l.Count - 2;
                    C  = Math.Sqrt(C);
                    return(A * B / C);
                }
                return((gr1.Mx.Q - gr2.Mx.Q) / Math.Sqrt((gr1.Dx.Q / gr1.l.Count) + (gr2.Dx.Q / gr2.l.Count)));
            }
            for (int i = 0; i < gr1.l.Count; i++)
            {
                Z.Add(gr1.unsortl[i] - gr2.unsortl[i]);
            }
            InitialStatisticalAnalys TG = new InitialStatisticalAnalys(Z);

            if (TG.Mx.Q == TG.Gx.Q && TG.Mx.Q == 0)
            {
                return(0);
            }
            return(TG.Mx.Q * Math.Sqrt(TG.l.Count) / TG.Gx.Q);
        }
예제 #2
0
        double[,] fFound(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2, int Ncol, int Nrow)
        {
            double[,] rez = new double[Ncol, Nrow];
            for (int i = 0; i < gr1.l.Count; i++)
            {
                for (int j = 0; j < Ncol; j++)
                {
                    for (int k = 0; k < Nrow; k++)
                    {
                        if (gr1.unsortl[i] <= (j + 1) * gr1.Len.Q / Ncol + gr1.Min.Q && gr1.unsortl[i] >= (j * gr1.Len.Q / Ncol + gr1.Min.Q) &&
                            gr2.unsortl[i] <= ((k + 1) * gr2.Len.Q / Nrow + gr2.Min.Q) && gr2.unsortl[i] >= (k * gr2.Len.Q / Nrow + gr2.Min.Q))
                        {
                            rez[j, k] += 1.0 / gr1.l.Count;
                            goto t1;
                        }
                    }
                }
                t1 :;
            }

            /*for (int j = 0; j < Ncol; j++)
             *  for (int k = 0; k < Nrow; k++)
             *      if (rez[j, k] <= gr1.alf)
             *          rez[j, k] = 0;*/
            return(rez);
        }
        static public string TypeRegresFound(InitialStatisticalAnalys ISAX, InitialStatisticalAnalys ISAY)
        {
            string[] Type    = Regex.Split(RegresTypeName.TypeRegresion, "\n");
            double[] Szalmas = new double[Type.Length];
            double   Korel   = KorelationFound(ISAX, ISAY);

            for (int i = 0; i < Type.Length; i++)
            {
                double      td = 0;
                List <Data> q  = RegresParamFound(ISAX, ISAY, Korel, Type[i], ref td);
                Szalmas[i] = SzalF(ISAX, ISAY, q, Type[i]);
            }
            double min   = Szalmas[0];
            int    index = 0;

            for (int i = 0; i < Type.Length; i++)
            {
                if (min != double.NaN && Szalmas[i] <= min)
                {
                    min   = Szalmas[i];
                    index = i;
                }
            }
            return(Type[index]);
        }
예제 #4
0
        static public double HiSqurdFound(InitialStatisticalAnalys gr, int l)
        {
            double        Hi = 0;
            List <double> Y4 = new List <double>();
            double        L  = (double)1 / gr.Mx.Q;

            for (double i = gr.l[0], v = 0; v < gr.Y2.Count; i += gr.Step.Q, v++)
            {
                if (l == 0)
                {
                    Y4.Add(Distributions.NormalFFound(((i + gr.Step.Q) - gr.Mx.Q) / gr.Gx.Q) - Distributions.NormalFFound((i - gr.Mx.Q) / gr.Gx.Q));
                }
                else if (l == 1)
                {
                    double F2 = 1 - Math.Exp(-(1 / gr.Mx.Q) * (gr.Min.Q + gr.Step.Q * (v + 1)));
                    double F1 = 1 - Math.Exp(-(1 / gr.Mx.Q) * (gr.Min.Q + gr.Step.Q * (v)));
                    Y4.Add(F2 - F1);
                }
                else if (l == 2)
                {
                    Y4.Add(gr.Step.Q / gr.Len.Q);
                }
            }
            for (int i = 0; i < gr.m.Q; i++)
            {
                Hi += (Math.Pow(Y4[i] - gr.f[i], 2) / Y4[i]) * gr.l.Count;
            }
            return(Math.Round(Hi, 4));
        }
#pragma warning disable IDE1006
        static public double[] fi1F(InitialStatisticalAnalys ISA)
        {
            double[] rez = new double[ISA.unsortl.Length]; ///page 108
            for (int i = 0; i < rez.Length; i++)
            {
                rez[i] = ISA.unsortl[i] - ISA.Mx.Q;
            }
            return(rez);
            //return element - mx;
        }
예제 #6
0
 double SimpleS(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
 {
     if (gr1.Dx.Q >= gr2.Dx.Q)
     {
         return(gr1.Dx.Q / gr2.Dx.Q);
     }
     else
     {
         return(gr2.Dx.Q / gr1.Dx.Q);
     }
 }
        static public double SzalF(InitialStatisticalAnalys ISAX, InitialStatisticalAnalys ISAY, List <Data> Q, string RegresTypeN)
        {
            double Szal = 0;

            for (int i = 0; i < ISAX.unsortl.Length; i++)
            {
                Szal += Math.Pow(ISAY.unsortl[i] - RegresType.Model(ISAX.unsortl[i], Q, RegresTypeN), 2);
            }
            Szal /= (ISAX.unsortl.Length - Q.Count);
            return(Math.Sqrt(Szal));
        }
예제 #8
0
        private double SzalFound(double[] AB, InitialStatisticalAnalys X, InitialStatisticalAnalys Y)
        {
            double rez = 0;

            for (int i = 0; i < Y.l.Count; i++)
            {
                rez += Math.Abs(Y.unsortl[i] - AB[0] - AB[1] * X.unsortl[i]);
            }
            rez /= X.l.Count;
            return(rez);
        }
        static public double[] fi2F(InitialStatisticalAnalys ISA)
        {
            double[] rez = new double[ISA.unsortl.Length]; ///page 108
            double   x3  = InitialStatisticalAnalys.StartMoment(ISA.l, 3);
            double   x2  = InitialStatisticalAnalys.StartMoment(ISA.l, 2);

            for (int i = 0; i < rez.Length; i++)
            {
                rez[i] = Math.Pow(ISA.unsortl[i], 2) - (x3 - x2 * ISA.Mx.Q) * (ISA.unsortl[i] - ISA.Mx.Q) / ISA.Dx.Q - x2;
            }
            return(rez);
        }
예제 #10
0
 public InitialStatisticalAnalys[] ToISA(int MaxGroup)
 {
     InitialStatisticalAnalys[] result = new InitialStatisticalAnalys[n];
     for (int i = 0; i < n; i++)
     {
         List <double> ISAData = new List <double>();
         for (int j = 0; j < data.Count; j++)
         {
             ISAData.Add(data[j][i]);
         }
         result[i] = new InitialStatisticalAnalys(ISAData, MaxGroup);
     }
     return(result);
 }
        private void CorelAreachartPaint(InitialAnalysMultidimensionalData IAM, Color CorelCol, Color GistCol, Chart CorelChart, Color ColLine)
        {
            for (int i = 0; i < IAM.n; i++)
            {
                for (int j = 0; j < IAM.n; j++)
                {
                    string    ChartAreaName = j.ToString() + "_" + i.ToString();
                    ChartArea ChartArea1    = new ChartArea(ChartAreaName);
                    ChartArea1.AxisX.LabelStyle.Enabled = false;
                    ChartArea1.AxisY.LabelStyle.Enabled = false;
                    CorelChart.ChartAreas.Add(ChartArea1);
                    var po = CorelAreachart.ChartAreas[0].Position;


                    Series ser;
                    if (i != j)
                    {
                        InitialStatisticalAnalys ISAX = new InitialStatisticalAnalys(InitialStatisticalAnalys.StandData(IAM.ISA[i].unsortl, IAM.ISA[i].Gx.Q, IAM.ISA[i].Mx.Q));
                        InitialStatisticalAnalys ISAY = new InitialStatisticalAnalys(InitialStatisticalAnalys.StandData(IAM.ISA[j].unsortl, IAM.ISA[j].Gx.Q, IAM.ISA[j].Mx.Q));
                        ser             = PaintData.CorelPaint(ISAX.unsortl, ISAY.unsortl, CorelCol, ChartAreaName);
                        ser.MarkerStyle = MarkerStyle.Circle;
                        CorelChart.Series.Add(ser);

                        double Sz = 0;
                        if (Correlation_RegressionAnalysis.KorelationZnach(IAM.K[i, j], IAM.N, IAM.ISA[0].alf.Q))
                        {
                            List <Data> Param = Correlation_RegressionAnalysis.RegresParamFound(
                                ISAX,
                                ISAY,
                                IAM.K[i, j], RegresTypeName.LineRegresion, ref Sz);
                            Series serReg = PaintData.LineRegresPaint(ISAX.Min.Q,
                                                                      ISAX.Max.Q,
                                                                      Param[0].Q,
                                                                      Param[1].Q,
                                                                      ColLine,
                                                                      ChartAreaName + "Line");
                            serReg.ChartArea = ChartAreaName;
                            CorelChart.Series.Add(serReg);
                        }
                    }
                    else
                    {
                        ser = PaintData.GistogPaint(IAM.ISA[i], GistCol, ChartAreaName);
                        CorelChart.Series.Add(ser);
                    }
                    ser.ChartArea = ChartAreaName;
                }
            }
        }
예제 #12
0
        double KrsumRangVilsFound(double[,] rang, InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            double KrsumRangVils = 0, Mw = 0, Dw = 0;

            for (int i = 0; i < N; i++)
            {
                if (rang[i, 1] == 0)
                {
                    KrsumRangVils += rang[i, 0];
                }
            }
            Mw = gr1.l.Count * (N + 1) / 2;
            Dw = gr1.l.Count * gr2.l.Count * (N + 1) / 12;
            return((KrsumRangVils - Mw) / Math.Sqrt(Dw));
        }
예제 #13
0
        static public Series GistogPaint(InitialStatisticalAnalys ISA, Color col, string SerName)
        {
            Series SerCor = new Series(SerName)
            {
                ChartType      = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column,
                BorderWidth    = 1,
                Color          = col,
                BorderColor    = Color.Black,
                ["PointWidth"] = "1"
            };

            for (double v = 0; v < ISA.Y2.Count; v++)
            {
                SerCor.Points.AddXY(Math.Round(ISA.Min.Q + ISA.Step.Q * v + ISA.Step.Q / 2, 3), ISA.f[(int)v]);
            }
            return(SerCor);
        }
예제 #14
0
 public double[] Mediana()
 {
     double[]        Me   = new double[n];
     List <double>[] Data = new List <double> [n];
     for (int i = 0; i < n; i++)
     {
         Data[i] = new List <double>();
     }
     for (int c = 0; c < n; c++)
     {
         for (int r = 0; r < data.Count; r++)
         {
             Data[c].Add(data[r][c]);
         }
         Me[c] = InitialStatisticalAnalys.MEDFound(Data[c]);
     }
     return(Me);
 }
        public static double KorelationFound(InitialStatisticalAnalys ISAX, InitialStatisticalAnalys ISAY)
        {
            double Mxy = 0;
            double sx = 0, sy = 0;

            for (int i = 0; i < ISAX.l.Count; i++)
            {
                sx  += ISAX.unsortl[i];
                sy  += ISAY.unsortl[i];
                Mxy += ISAX.unsortl[i] * ISAY.unsortl[i];
            }
            var ty = Mxy / Math.Sqrt(sx * sy);

            Mxy /= ISAX.l.Count;

            return((ISAX.l.Count / (ISAX.l.Count - 1)) *
                   ((Mxy - ISAX.Mx.Q * ISAY.Mx.Q) / (ISAX.Gx.Q * ISAY.Gx.Q)));
        }
        private double X2fFound(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2, double[,] f)
        {
            double rez = 0;

            for (int i = 0; i < f.GetLength(0); i++)
            {
                for (int j = 0; j < f.GetLength(1); j++)
                {
                    double f1 = Distributions.NormalDoublefFound(
                        ((i + 0.5) * gr1.Len.Q / f.GetLength(0) + gr1.Min.Q), gr1.Mx.Q, gr1.Gx.Q,
                        ((j + 0.5) * gr2.Len.Q / f.GetLength(1) + gr2.Min.Q), gr2.Mx.Q, gr2.Gx.Q, Korelation[0]) *
                                (gr2.Len.Q / f.GetLength(1)) * (gr1.Len.Q / f.GetLength(0));
                    if (Math.Round(f1, 4) != 0)
                    {
                        rez += Math.Pow(f[i, j] - f1, 2) / f1;
                    }
                }
            }
            return(rez);
        }
예제 #17
0
        double RizSerRangVibFound(double[,] rang, InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            double Mrx = 0, Mry = 0;

            for (int i = 0; i < N; i++)
            {
                if (rang[i, 1] == 0)
                {
                    Mrx += rang[i, 0];
                }
                else if (rang[i, 1] == 1)
                {
                    Mry += rang[i, 0];
                }
            }
            Mrx /= gr1.l.Count;
            Mry /= gr2.l.Count;
            double v = (Mrx - Mry) / (N * Math.Sqrt((N + 1) / (12.0 * gr1.l.Count * gr2.l.Count)));

            return(v);
        }
        private void ABTailFound(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            double        B = 0;
            double        A = 0;
            List <double> b = new List <double>();

            for (int i = 1; i < gr1.l.Count; i++)
            {
                for (int j = 0; j < i; j++)
                {
                    b.Add((gr2.unsortl[j] - gr2.unsortl[i]) / (gr1.unsortl[j] - gr1.unsortl[i]));
                }
            }
            b.Sort();
            if (b.Count % 2 == 0)
            {
                B = (b[b.Count / 2 - 1] + b[b.Count / 2]) / 2;
            }
            else
            {
                B = b[(b.Count - 1) / 2];
            }
            List <double> a = new List <double>();

            for (int i = 0; i < gr1.l.Count; i++)
            {
                a.Add(gr2.unsortl[i] - B * gr1.unsortl[i]);
            }
            a.Sort();
            if (a.Count % 2 == 0)
            {
                A = (a[a.Count / 2 - 1] + a[a.Count / 2]) / 2;
            }
            else
            {
                A = a[(a.Count - 1) / 2];
            }
            ABTeil[0] = A;
            ABTeil[1] = B;
        }
예제 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ML"></param>
        /// <param name="gr"></param>
        /// <param name="type"></param>
        /// <returns>P</returns>
        static public double KolmagorovFound(List <double> ML, InitialStatisticalAnalys gr, int type, double Mx, double Gx)
        {
            double D   = DFound(ML, gr, type, Mx, Gx);
            double Z   = Math.Sqrt(ML.Count) * D;
            double rez = 0;
            double A1  = (double)1 / (18 * ML.Count);

            for (int k = 1; k < 75; k++)
            {
                double f1 = k * k - 0.5 * (1 - Math.Pow(-1, k));
                double f2 = 5 * k * k + 22 - 7.5 * (1 - Math.Pow(-1, k));
                //double O = Math.Pow(Z, 13) / Math.Pow(ML.Count,2);
                double C1 = (f1 - 4 * (f1 + 3)) * Math.Pow(Z * k, 2) + 8 * Math.Pow(k * Z, 4);
                double C2 = (f2 * f2 / 5 - 4 * (f2 + 45) * Math.Pow(Z * k, 2) / (15) + 8 * Math.Pow(k * Z, 4));
                double B1 = 1 - 2 * k * k * Z / (3 * Math.Sqrt(ML.Count));
                double A2 = k * k * Z / (27 * Math.Pow(ML.Count, 1.5));
                double G  = Math.Pow(-1, k) * Math.Exp((double)-2 * Math.Pow(k * Z, 2));
                rez += G * (B1 - A1 * C1 + A2 * C2);
            }
            rez *= 2;
            return(-rez);
        }
예제 #20
0
 static private double DFound(List <double> ML, InitialStatisticalAnalys gr, int Type, double Mx, double Gx)
 {
     double[] D = new double[2];
     for (int i = 0; i < gr.l.Count - 1; i++)
     {
         double l    = 0;
         double lmin = 0;
         if (Type == 0)
         {
             double v1 = Distributions.NormalFFound((gr.l[i] - Mx) / Gx);
             l = Math.Abs(gr.F[i] - v1);
             if (i > 0)
             {
                 v1   = Distributions.NormalFFound((gr.l[i - 1] - Mx) / Gx);
                 lmin = Math.Abs(gr.F[i] - v1);
             }
         }
         else if (Type == 1)
         {
             l = Math.Abs(gr.F[i] - 1 + Math.Pow(2.73, -(1 / (Mx - gr.Min.Q)) * (gr.l[i] - gr.Min.Q)));
             if (i > 0)
             {
                 lmin = Math.Abs(gr.F[i] - 1 + Math.Pow(2.73, -(1 / (Mx - gr.Min.Q)) * (gr.l[i - 1] - gr.l[0])));
             }
         }
         else if (Type == 2)
         {
             l = Math.Abs(gr.F[i] - ((gr.l[i] - gr.l[0]) / gr.Len.Q));
             if (i > 0)
             {
                 lmin = Math.Abs(gr.F[i] - ((gr.l[i - 1] - ML[0]) / gr.Len.Q));
             }
         }
         D[1] = Math.Max(l, D[1]);
         D[0] = Math.Max(lmin, D[0]);
     }
     return(Math.Max(D[0], D[1]));
 }
예제 #21
0
        private double ZFound(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            double D = 0;

            for (int i = 0; i < gr1.l.Count; i++)
            {
                double l2 = 0;
                if (gr2.AvtoType == Distributions.Normal)
                {
                    l2 = Distributions.NormalfFound(gr1.l[i], gr2.Mx.Q, gr2.Gx.Q);
                }
                else if (gr2.AvtoType == Distributions.Exp)
                {
                    l2 = Distributions.ExpFound(gr1.l[i], gr2.Mx.Q);
                }
                else if (gr2.AvtoType == Distributions.Line)
                {
                    l2 = (gr1.l[i] - gr2.Min.Q) * gr2.Len.Q;
                }

                D = Math.Max(Math.Abs(gr1.F[i] - l2), D);
            }
            return(D);
        }
예제 #22
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);
            }
        }
예제 #23
0
        double KrUMannaUitFound(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            double u = 0, Mu = 0, Du = 0;

            double[,] z = new double[gr1.l.Count, gr2.l.Count];
            for (int i = 0; i < gr1.l.Count; i++)
            {
                for (int j = 0; j < gr2.l.Count; j++)
                {
                    if (gr1.unsortl[i] > gr2.unsortl[j])
                    {
                        z[i, j] = 1;
                        u++;
                    }
                    else
                    {
                        z[i, j] = 0;
                    }
                }
            }
            Mu = gr1.l.Count * gr2.l.Count / 2;
            Du = Mu * (N + 1) / 6;
            return((u - Mu) / Math.Sqrt(Du));
        }
예제 #24
0
        static public void Repaint(InitialStatisticalAnalys gr, Chart chart1, Chart chart2)
        {
            chart1.ChartAreas[0].AxisX.LabelStyle.Format = "###,##0.000";
            chart1.ChartAreas[0].AxisY.LabelStyle.Format = "###,##0.000";

            chart2.ChartAreas[0].AxisX.LabelStyle.Format = "###,##0.000";
            chart2.ChartAreas[0].AxisY.LabelStyle.Format = "###,##0.000";
            ///++++++++++++++++++++++++++++++++++++++++++++++
            ///GISTOGAMA_PAINT
            ///++++++++++++++++++++++++++++++++++++++++++++++
            ///


            chart1.Titles[0].Text = "f";
            chart1.Titles[1].Text = "x";
            chart2.Titles[0].Text = "x";
            chart2.Titles[1].Text = "F";

            chart1.Series.Clear();
            chart2.Series.Clear();
            chart1.Series.Add(GistogPaint(gr, Color.DarkBlue, "f"));/*
                                                                     * chart1.Series["f"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
                                                                     * chart1.Series["f"]["PointWidth"] = "1";
                                                                     * chart1.Series["f"].BorderWidth = 1;
                                                                     * chart1.Series["f"].Color = Color.DarkBlue;
                                                                     * chart1.Series["f"].BorderColor = Color.Black;*/
            chart1.Series.Add("01");
            chart1.Series["01"].IsVisibleInLegend = false;
            chart1.Series["01"].ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart1.Series["01"].BorderWidth       = 2;
            chart1.Series["01"].Color             = Color.Red;
            chart1.ChartAreas[0].AxisX.Minimum    = chart2.ChartAreas[0].AxisX.Minimum = Math.Round(gr.Min.Q - 0.1 * (gr.Len.Q), 3);
            chart1.ChartAreas[0].AxisX.Maximum    = chart2.ChartAreas[0].AxisX.Maximum = Math.Round(gr.Max.Q + 0.1 * (gr.Len.Q), 3);
            chart1.ChartAreas[0].AxisX.Interval   = chart2.ChartAreas[0].AxisX.Interval = Math.Round(0.1 * (gr.Len.Q), 3);
            chart1.ChartAreas[0].AxisY.Interval   = 0.05;
            chart2.ChartAreas[0].AxisY.Interval   = 0.1;
            chart1.ChartAreas[0].AxisY.Minimum    = chart2.ChartAreas[0].AxisY.Minimum = 0;
            chart2.ChartAreas[0].AxisY.Maximum    = 1;
            chart1.ChartAreas[0].AxisY.Maximum    = gr.f.Max() + 0.07;


            chart2.Series.Add("-1");
            chart2.Series["-1"].ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart2.Series["-1"].Color             = Color.Green;
            chart2.Series["-1"].BorderWidth       = 3;
            chart2.Series["-1"].IsVisibleInLegend = false;
            chart2.Series["-1"].Points.AddXY(gr.Min.Q - gr.Step.Q, 0);
            chart2.Series["-1"].Points.AddXY(gr.Min.Q, 0);
            chart2.Series["-1"].Points.AddXY(gr.Min.Q - gr.Step.Q * 0.1, 0 + 0.03);
            chart2.Series["-1"].Points.AddXY(gr.Min.Q, 0);
            chart2.Series["-1"].Points.AddXY(gr.Min.Q - gr.Step.Q * 0.1, 0 - 0.03);

            chart2.Series.Add("-2");
            chart2.Series["-2"].ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart2.Series["-2"].Color             = Color.Green;
            chart2.Series["-2"].BorderWidth       = 3;
            chart2.Series["-2"].IsVisibleInLegend = false;
            chart2.Series["-2"].Points.AddXY(gr.Max.Q, 1);
            chart2.Series["-2"].Points.AddXY(gr.Max.Q + gr.Step.Q, 1);
            chart2.Series["-2"].Points.AddXY(gr.Max.Q + gr.Step.Q * 0.9, 1 + 0.03);
            chart2.Series["-2"].Points.AddXY(gr.Max.Q + gr.Step.Q, 1);
            chart2.Series["-2"].Points.AddXY(gr.Max.Q + gr.Step.Q * 0.9, 1 - 0.03);

            chart2.Series.Add("Інтервал \nпередбачення");
            chart2.Series["Інтервал \nпередбачення"].ChartType     = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart2.Series["Інтервал \nпередбачення"].BorderWidth   = 2;
            chart2.Series["Інтервал \nпередбачення"]["PointWidth"] = "2";
            chart2.Series["Інтервал \nпередбачення"].Color         = Color.Black;

            chart2.Series.Add("Інтервал передбачення2");
            chart2.Series["Інтервал передбачення2"].IsVisibleInLegend = false;
            chart2.Series["Інтервал передбачення2"].ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart2.Series["Інтервал передбачення2"].BorderWidth       = 2;
            chart2.Series["Інтервал передбачення2"]["PointWidth"]     = "2";
            chart2.Series["Інтервал передбачення2"].Color             = Color.Black;
            chart2.Series["Інтервал \nпередбачення"].Points.AddXY(gr.predictioninterval.QButton, 0);
            chart2.Series["Інтервал \nпередбачення"].Points.AddXY(gr.predictioninterval.QButton, 1);
            chart2.Series["Інтервал передбачення2"].Points.AddXY(gr.predictioninterval.QUpper, 0);
            chart2.Series["Інтервал передбачення2"].Points.AddXY(gr.predictioninterval.QUpper, 1);



            for (double i = gr.l[0], v = 0, F = 0; v < gr.Y2.Count; i += gr.Step.Q, v++, F++)
            {
                string str;
                if (F == 0)
                {
                    str = "F";
                }
                else
                {
                    str = Convert.ToString(F);
                }
                chart2.Series.Add(str);
                chart2.Series[str].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                chart2.Series[str].Color       = Color.Green;
                chart2.Series[str].BorderWidth = 3;
                if (F != 0)
                {
                    chart2.Series[str].IsVisibleInLegend = false;
                }
                chart2.Series[str].Points.AddXY(gr.Min.Q + gr.Step.Q * v, gr.Y2[(int)v]);
                chart2.Series[str].Points.AddXY(gr.Min.Q + gr.Step.Q * (v + 1), gr.Y2[(int)v]);
                chart2.Series[str].Points.AddXY(gr.Min.Q + gr.Step.Q * (v + 0.9), gr.Y2[(int)v] + 0.03);
                chart2.Series[str].Points.AddXY(gr.Min.Q + gr.Step.Q * (v + 1), gr.Y2[(int)v]);
                chart2.Series[str].Points.AddXY(gr.Min.Q + gr.Step.Q * (v + 0.9), gr.Y2[(int)v] - 0.03);
                //chart1.Series["f"].Points.AddXY(Math.Round(gr.Min.Q + gr.Step.Q * v + gr.Step.Q / 2,3), gr.f[(int)v]);
            }
            string str2 = "F не розбита\n на класи";

            chart2.Series.Add(str2);
            chart2.Series[str2].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
            chart2.Series[str2].Color       = Color.Red;
            chart2.Series[str2].BorderWidth = 3;
            for (int i = 0; i < gr.l.Count; i++)
            {
                chart2.Series[str2].Points.AddXY(Math.Round(gr.l[i], 3), Math.Round(gr.F[i], 3));
            }
        }
예제 #25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ML"></param>
 /// <param name="gr"></param>
 /// <param name="type"></param>
 /// <returns>P</returns>
 static public double KolmagorovFound(List <double> ML, InitialStatisticalAnalys gr, int type)
 {
     return(KolmagorovFound(ML, gr, type, gr.Mx.Q, gr.Gx.Q));
 }
        static public List <Data> RegresParamFound(InitialStatisticalAnalys ISAX, InitialStatisticalAnalys ISAY, double Korelation, string TypeRegVib, ref double Szal2)
        {
            List <Data> Qm = new List <Data>();

            if (TypeRegVib == RegresTypeName.ParabRegresion)
            {
                Data a = new Data(), b = new Data(), c = new Data();
                Qm.Add(a);
                Qm.Add(b);
                Qm.Add(c);
                a.Name = "a";
                b.Name = "b";
                c.Name = "c";
                double n1 = 0;//107 page andan
                double x2 = InitialStatisticalAnalys.StartMoment(ISAX.l, 2);
                double x3 = InitialStatisticalAnalys.StartMoment(ISAX.l, 3);
                double x4 = InitialStatisticalAnalys.StartMoment(ISAX.l, 4);
                for (int i = 0; i < ISAX.unsortl.Length; i++)
                {
                    n1 += (ISAY.unsortl[i] - ISAY.Mx.Q) * (Math.Pow(ISAX.unsortl[i], 2) - x2);
                }
                n1  /= ISAX.unsortl.Length;
                c.Q  = ISAX.Dx.Q * n1 - (x3 - x2 * ISAX.Mx.Q) * Korelation * ISAX.Gx.Q * ISAY.Gx.Q;
                c.Q /= ISAX.Dx.Q * (x4 - Math.Pow(x2, 2)) - Math.Pow(x3 - x2 * ISAX.Mx.Q, 2);
                b.Q  = (x4 - Math.Pow(x2, 2)) * Korelation * ISAX.Gx.Q * ISAY.Gx.Q - (x3 - x2 * ISAX.Mx.Q) * n1;
                b.Q /= ISAX.Dx.Q * (x4 - Math.Pow(x2, 2)) - Math.Pow(x3 - x2 * ISAX.Mx.Q, 2);
                a.Q  = ISAY.Mx.Q - b.Q * ISAX.Mx.Q - c.Q * ISAX.X_2.Q;
                Data a2 = new Data(), b2 = new Data(), c2 = new Data();
                Qm.Add(a2);
                Qm.Add(b2);
                Qm.Add(c2);
                a2.Name = "a2";
                b2.Name = "b2";
                c2.Name = "c2";
                a2.Q    = ISAY.Mx.Q;
                double Mfi2scv = 0;
                {
                    double TD = 0;
                    for (int i = 0; i < ISAX.l.Count; i++)
                    {
                        Mfi2scv += Math.Pow(fi2F(ISAX.unsortl[i], ISAX.Dx.Q, ISAX.Mx.Q, x2, x3), 2);
                        b2.Q    += (ISAX.unsortl[i] - ISAX.Mx.Q) * ISAY.unsortl[i];
                        c2.Q    += fi2F(ISAX.unsortl[i], ISAX.Dx.Q, ISAX.Mx.Q, x2, x3) * ISAY.unsortl[i];
                        TD      += Math.Pow(fi2F(ISAX.unsortl[i], ISAX.Dx.Q, ISAX.Mx.Q, x2, x3), 2);
                    }
                    c2.Q /= TD;
                }
                Mfi2scv /= ISAX.l.Count;
                b2.Q    /= ISAX.l.Count;
                b2.Q    /= ISAX.Dx.Q;
                Szal2    = 0;
                for (int i = 0; i < ISAX.l.Count; i++)
                {
                    Szal2 += Math.Pow(ISAY.unsortl[i] - a2.Q - b2.Q * fi1F(ISAX.unsortl[i], ISAX.Mx.Q) - c2.Q * fi2F(ISAX.unsortl[i], ISAX.Dx.Q, ISAX.Mx.Q, x2, x3), 2);
                }
                Szal2    /= ISAX.l.Count - 3;
                Szal2     = Math.Sqrt(Szal2);
                a2.QSigma = Szal2 / Math.Sqrt(ISAX.unsortl.Length);
                b2.QSigma = Szal2 / (ISAX.Dx.Q * Math.Sqrt(ISAX.unsortl.Length));
                c2.QSigma = Szal2 / Math.Sqrt(ISAX.unsortl.Length * Mfi2scv);
                double Tt = Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 3);
                a2.QButton = a2.Q - Tt * a2.QSigma;
                a2.QUpper  = a2.Q + Tt * a2.QSigma;
                b2.QButton = b2.Q - Tt * b2.QSigma;
                b2.QUpper  = b2.Q + Tt * b2.QSigma;
                c2.QButton = c2.Q - Tt * c2.QSigma;
                c2.QUpper  = c2.Q + Tt * c2.QSigma;
                double at = ISAY.Mx.Q - b.Q * ISAX.Mx.Q - c.Q * Math.Pow(ISAX.Mx.Q, 2) - a.Q;
                Data   ta = new Data(), tb = new Data(), tc = new Data();
            }
            else
            {
                Data a = new Data(), b = new Data();
                Qm.Add(a);
                Qm.Add(b);
                a.Name = "a";
                b.Name = "b";
                List <double> t = new List <double>();
                List <double> z = new List <double>();
                for (int i = 0; i < ISAX.unsortl.Length; i++)
                {
                    t.Add(RegresType.FiX(ISAX.unsortl[i], TypeRegVib));
                    z.Add(RegresType.FiY(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib));
                }

                /*double Mfx = 0,Mfxfx=0, Mfy = 0, Mfxfy = 0,W = 0;
                 * for (int i = 0; i < ISAX.unsortl.Length; i++)
                 * {
                 *  Mfx += RegresType.FiX(ISAX.unsortl[i], TypeRegVib) *
                 *      RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *  Mfxfx += Math.Pow(RegresType.FiX(ISAX.unsortl[i], TypeRegVib),2) *
                 *      RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *  Mfy += RegresType.FiY(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib) *
                 *      RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *  Mfxfy += RegresType.FiX(ISAX.unsortl[i], TypeRegVib) * RegresType.FiY(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib) *
                 *      RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *  W += RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *
                 * }
                 * Mfx /= W;
                 * Mfxfx /= W;
                 * Mfxfy /= W;
                 * Mfy /= W;*/
                // Qm[1].Q = (Mfxfy - Mfx * Mfy) / (Mfxfx - Math.Pow(Mfx, 2));
                //Qm[0].Q = Mfy - Qm[1].Q * Mfx;
                InitialStatisticalAnalys ISAt = new InitialStatisticalAnalys(t);
                InitialStatisticalAnalys ISAz = new InitialStatisticalAnalys(z);
                double Kor_tz = Correlation_RegressionAnalysis.KorelationFound(ISAt, ISAz);
                Qm[1].Q = Kor_tz * ISAz.Gx.Q / ISAt.Gx.Q;
                Qm[0].Q = RegresType.A(ISAz.Mx.Q - Qm[1].Q * ISAt.Mx.Q, TypeRegVib);
                double Szal = SzalF(ISAX, ISAY, Qm, TypeRegVib);
                Qm[0].QSigma  = RegresType.A(Szal * Math.Sqrt(1.0 / ISAX.unsortl.Length + Math.Pow(ISAt.Mx.Q, 2) / (ISAt.Dx.Q * (ISAX.unsortl.Length - 1))), TypeRegVib);
                Qm[1].QSigma  = Szal / (ISAX.unsortl.Length - 1);
                Qm[0].QButton = RegresType.A(Qm[0].Q - Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 2) * Qm[0].QSigma, TypeRegVib);
                Qm[0].QUpper  = RegresType.A(Qm[0].Q + Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 2) * Qm[0].QSigma, TypeRegVib);
                Qm[1].QButton = Qm[1].Q - Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 2) * Qm[1].QSigma;
                Qm[1].QUpper  = Qm[1].Q + Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 2) * Qm[1].QSigma;
            }
            return(Qm);
        }
        private bool NachYslovRegAnal(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2)
        {
            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 - Q[0].Q - Q[1].Q * ((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);
        }
예제 #28
0
        private void BottomValueToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try { MinimalDispersValue = Convert.ToDouble(MinimalDispers.Text); }
            catch { MinimalDispersValue = 0; }

            if (IAM.n == 2)
            {
                double corel = IAM.K[0, 1];
                double fi    = Math.Atan(2 * corel * IAM.ISA[0].Gx.Q * IAM.ISA[1].Gx.Q /
                                         (Math.Pow(IAM.ISA[0].Gx.Q, 2) - Math.Pow(IAM.ISA[1].Gx.Q, 2))) / 2;
                picture.Image = PaintData.RotateImage(new Bitmap(picture.Image), fi);
            }
            double[,] Xallstandart = new double[IAM.Xall.GetLength(0), IAM.Xall.GetLength(1)];
            for (int i = 0; i < IAM.Xall.GetLength(0); i++)
            {
                for (int j = 0; j < IAM.Xall.GetLength(1); j++)
                {
                    Xallstandart[i, j] = (IAM.Xall[i, j] - IAM.Ex[j]) /* / IAM.ISA[j].Gx.Q*/;
                }
            }
            double[,] X = Matrix.MultiplicMatrix(Xallstandart, IAM.eightvector);


            int MaxGroup = -1;

            for (int j = 0; j < ML.Count; j++)
            {
                MaxGroup = Math.Max(MaxGroup, ML[j].Group);
            }
            List <int> index = new List <int>();

            for (int i = 0; i < IAM.n; i++)
            {
                List <double> Data = new List <double>();
                for (int j = 0; j < IAM.N; j++)
                {
                    Data.Add(X[j, i]);
                }
                InitialStatisticalAnalys ISA = new InitialStatisticalAnalys(Data, MaxGroup + 1);
                if (ISA.Dx.Q >= MinimalDispersValue)
                {
                    ML.Add(ISA);
                    index.Add(ML.Count - 1);
                    undolist.Add(ML[ML.Count - 1].unsortl);
                }
            }
            WraitData.RefreshList(treeView1, ML);
            IAMIndepended         = new InitialAnalysMultidimensionalData(ML, index, -1);
            IAMIndependedToRevers = new InitialAnalysMultidimensionalData(X, 1);
            ReversTransformValueToolStripMenuItem.Visible = true;

            Procent = new double[IAM.n];
            for (int c = 0; c < IAM.n; c++)
            {
                for (int r = 0; r < IAMIndepended.Xall.GetLength(1); r++)
                {
                    Procent[c] += Math.Pow(IAM.eightvector[r, c], 2);
                }
                Procent[c] *= 100;
            }

            DataGridView.Rows.Clear();
            SetData();
            SetNextData();
        }
예제 #29
0
 double cov(InitialStatisticalAnalys ISAe1, InitialStatisticalAnalys ISAe2)
 {
     return(ISAe1.Gx.Q * ISAe2.Gx.Q * Correlation_RegressionAnalysis.KorelationFound(ISAe1, ISAe2));
 }
예제 #30
0
        static public void Repaint(InitialStatisticalAnalys gr, InitialStatisticalAnalys gr2, Correlation_RegressionAnalysis CRA, Chart chart1, Chart chart2)
        {
            chart1.ChartAreas[0].AxisX.LabelStyle.Format = "###,##0.000";
            chart1.ChartAreas[0].AxisY.LabelStyle.Format = "###,##0.000";

            chart2.ChartAreas[0].AxisX.LabelStyle.Format = "###,##0.000";
            chart2.ChartAreas[0].AxisY.LabelStyle.Format = "###,##0.000";
            ///++++++++++++++++++++++++++++++++++++++++++++++
            ///GISTOGAMA_PAINT
            ///++++++++++++++++++++++++++++++++++++++++++++++
            chart1.Series.Clear();
            chart2.Series.Clear();

            if (CRA.f == null)
            {
                return;
            }
            chart1.Series.Add(CorelPaint(gr.unsortl, gr2.unsortl, Color.DarkBlue, "f"));
            chart1.ChartAreas[0].AxisX.Minimum  = gr.Min.Q - gr.Len.Q * 0.05;
            chart1.ChartAreas[0].AxisX.Maximum  = gr.Max.Q + gr.Len.Q * 0.05;
            chart1.ChartAreas[0].AxisX.Interval = Math.Round(gr.Len.Q * 0.1, 3);
            chart1.ChartAreas[0].AxisY.Interval = Math.Round(gr2.Len.Q * 0.1, 3);
            chart1.ChartAreas[0].AxisY.Minimum  = gr2.Min.Q - gr2.Len.Q * 0.05;
            chart1.ChartAreas[0].AxisY.Maximum  = gr2.Max.Q + gr2.Len.Q * 0.05;
            chart2.ChartAreas[0].AxisX.Minimum  = chart2.ChartAreas[0].AxisY.Minimum = 0;
            chart2.ChartAreas[0].AxisX.Maximum  = CRA.f.GetLength(0);
            chart2.ChartAreas[0].AxisY.Maximum  = CRA.f.GetLength(1);
            chart2.ChartAreas[0].AxisX.Interval = chart2.ChartAreas[0].AxisY.Interval = 100;

            chart1.Titles[0].Text = "y";
            chart1.Titles[1].Text = "x";
            chart2.Titles[0].Text = "x";
            chart2.Titles[1].Text = "y";

            chart2.ChartAreas[0].AxisY.CustomLabels.Clear();

            /*for (int j = 0; j < CRA.f.GetLength(0); j++)
             * {
             *  string str2 = "";
             *  for (int k = 0; k < CRA.f.GetLength(1); k++)
             *  {
             *      str2 = "f" + j.ToString() + "_" + k.ToString();
             *      chart2.Series.Add(str2);
             *      chart2.Series[str2].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
             *      chart2.Series[str2].MarkerStyle = MarkerStyle.Square;
             *      chart2.Series[str2].IsVisibleInLegend = false;
             *      chart2.Series[str2].MarkerSize = (chart2.Size.Width - 20 + k * 10) / CRA.f.GetLength(0);
             *      //chart2.Series[str2]["PixelPointWidth"] = "200";//PointWidth
             *      double z = CRA.f[j, k];
             *      if (z > 0.07)
             *          chart2.Series[str2].Color = Color.Black;
             *      else
             *      {
             *          int r = 255 - (int)(255 * CRA.f[j, k] / 0.07);
             *          chart2.Series[str2].Color = Color.FromArgb(r, r, r);
             *      }
             *      //chart2.Series[str2].Color = Color.FromArgb(r, r, r);
             *      //chart2.Series[str2]["StackedGroupName"] = "Group" + j.ToString();
             *      chart2.Series[str2].Points.AddXY(j + 0.5,
             *          k + 0.5);
             *  }
             * }*/
            Image      d  = PaintData.Paintf(CRA, 1000, 1000);
            NamedImage ni = new NamedImage("backimage", d);

            chart2.Images.Add(ni);
            chart2.ChartAreas[0].BackImageAlignment = ChartImageAlignmentStyle.Center;
            chart2.ChartAreas[0].BackImageWrapMode  = ChartImageWrapMode.Scaled;
            chart2.ChartAreas[0].BackImage          = "backimage";

            if (CRA.Doubl == true && CRA.Nezal == true)
            {
                chart1.Series.Add("Лін Рег" + ":" + CRA.RegresTypeVib);
                chart1.Series["Лін Рег" + ":" + CRA.RegresTypeVib].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                chart1.Series["Лін Рег" + ":" + CRA.RegresTypeVib].Color       = Color.Yellow;
                chart1.Series["Лін Рег" + ":" + CRA.RegresTypeVib].BorderWidth = 3;
                if (CRA.RegresTypeVib == RegresTypeName.LineRegresion)
                {
                    //CRA.ABTeil
                    ///teilor
                    chart1.Series.Add("Лін Рег Тейл");
                    chart1.Series["Лін Рег Тейл"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                    chart1.Series["Лін Рег Тейл"].Color     = Color.Green;
                    chart1.Series["Лін Рег Тейл"].Points.AddXY(gr.Min.Q, CRA.ABTeil[0] + gr.Min.Q * CRA.ABTeil[1]);
                    chart1.Series["Лін Рег Тейл"].BorderWidth = 3;
                    chart1.Series["Лін Рег Тейл"].Points.AddXY(gr.Max.Q, CRA.ABTeil[0] + gr.Max.Q * CRA.ABTeil[1]);
                }

                chart1.Series.Add("Тол меж");
                chart1.Series["Тол меж"].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                chart1.Series["Тол меж"].Color       = Color.DarkRed;
                chart1.Series["Тол меж"].BorderWidth = 2;
                chart1.Series.Add("Тол меж2");
                chart1.Series["Тол меж2"].ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                chart1.Series["Тол меж2"].Color             = chart1.Series["Тол меж"].Color;
                chart1.Series["Тол меж2"].IsVisibleInLegend = false;
                chart1.Series["Тол меж2"].BorderWidth       = 2;

                chart1.Series.Add("Дов інтр");
                chart1.Series["Дов інтр"].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                chart1.Series["Дов інтр"].Color       = Color.DarkMagenta;
                chart1.Series["Дов інтр"].BorderWidth = 2;
                chart1.Series.Add("Дов інтр2");
                chart1.Series["Дов інтр2"].ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                chart1.Series["Дов інтр2"].Color             = chart1.Series["Дов інтр"].Color;
                chart1.Series["Дов інтр2"].IsVisibleInLegend = false;
                chart1.Series["Дов інтр2"].BorderWidth       = 2;
                if (CRA.RegresTypeVib != RegresTypeName.ParabRegresion)
                {
                    for (double x0 = gr.Min.Q; x0 <= gr.Max.Q; x0 += gr.Len.Q * 0.005)
                    {
                        double Sx0 = Math.Sqrt(CRA.Szal * (1 + 1.0 / gr.l.Count) + CRA.Q[1].QSigma * Math.Pow(x0 - gr.Mx.Q, 2));
                        if (CRA.RegresTypeVib == RegresTypeName.LineRegresion)
                        {
                            chart1.Series["Дов інтр"].Points.AddXY(x0, RegresType.Model(x0, CRA.Q, CRA.RegresTypeVib) - CRA.T * Sx0);
                            chart1.Series["Дов інтр2"].Points.AddXY(x0, RegresType.Model(x0, CRA.Q, CRA.RegresTypeVib) + CRA.T * Sx0);
                        }
                        chart1.Series["Тол меж"].Points.AddXY(x0, RegresType.Model(x0, CRA.Q, CRA.RegresTypeVib) - CRA.T * CRA.Szal);
                        chart1.Series["Тол меж2"].Points.AddXY(x0, RegresType.Model(x0, CRA.Q, CRA.RegresTypeVib) + CRA.T * CRA.Szal);
                    }
                    for (double x0 = gr.Min.Q; x0 <= gr.Max.Q; x0 += gr.Len.Q * 0.005)
                    {
                        chart1.Series["Лін Рег" + ":" + CRA.RegresTypeVib].Points.AddXY(x0, RegresType.Model(x0, CRA.Q, CRA.RegresTypeVib));
                    }
                }
                else if (CRA.RegresTypeVib == RegresTypeName.ParabRegresion)
                {
                    double x2 = InitialStatisticalAnalys.StartMoment(gr.l, 2);
                    double x3 = InitialStatisticalAnalys.StartMoment(gr.l, 3);
                    double x4 = InitialStatisticalAnalys.StartMoment(gr.l, 4);
                    double Tt = Distributions.StudentQuantile(1 - gr.alf.Q / 2, gr.unsortl.Length - 3);
                    for (double x0 = gr.Min.Q; x0 <= gr.Max.Q; x0 += gr.Len.Q * 0.005)
                    {
                        double Sx0 = Math.Sqrt(Math.Pow(CRA.Szal2, 2) * (1 + 1.0 / gr.l.Count) +
                                               Math.Pow(CRA.Q[4].QSigma * Correlation_RegressionAnalysis.fi1F(x0, gr.Mx.Q), 2) +
                                               Math.Pow(CRA.Q[5].QSigma * Correlation_RegressionAnalysis.fi2F(x0, gr.Dx.Q, gr.Mx.Q, x2, x3), 2));

                        /*
                         * chart1.Series["Дов інтр"].Points.AddXY(x0, RegresType.Model(x0, CRA.Q, CRA.RegresTypeVib) - CRA.T * Sx0);
                         * chart1.Series["Дов інтр2"].Points.AddXY(x0, RegresType.Model(x0, CRA.Q, CRA.RegresTypeVib) + CRA.T * Sx0);*/

                        chart1.Series["Дов інтр"].Points.AddXY(x0, CRA.Q[3].Q + CRA.Q[4].Q * Correlation_RegressionAnalysis.fi1F(x0, gr.Mx.Q)
                                                               + CRA.Q[5].Q * Correlation_RegressionAnalysis.fi2F(x0, gr.Dx.Q, gr.Mx.Q, x2, x3)
                                                               - Tt * Sx0);
                        chart1.Series["Дов інтр2"].Points.AddXY(x0, CRA.Q[3].Q + CRA.Q[4].Q * Correlation_RegressionAnalysis.fi1F(x0, gr.Mx.Q)
                                                                + CRA.Q[5].Q * Correlation_RegressionAnalysis.fi2F(x0, gr.Dx.Q, gr.Mx.Q, x2, x3)
                                                                + Tt * Sx0);


                        chart1.Series["Тол меж"].Points.AddXY(x0, CRA.Q[3].Q + CRA.Q[4].Q * Correlation_RegressionAnalysis.fi1F(x0, gr.Mx.Q)
                                                              + CRA.Q[5].Q * Correlation_RegressionAnalysis.fi2F(x0, gr.Dx.Q, gr.Mx.Q, x2, x3)
                                                              - Tt * CRA.Szal2);
                        chart1.Series["Тол меж2"].Points.AddXY(x0, CRA.Q[3].Q + CRA.Q[4].Q * Correlation_RegressionAnalysis.fi1F(x0, gr.Mx.Q)
                                                               + CRA.Q[5].Q * Correlation_RegressionAnalysis.fi2F(x0, gr.Dx.Q, gr.Mx.Q, x2, x3)
                                                               + Tt * CRA.Szal2);
                    }
                    for (double x0 = gr.Min.Q; x0 <= gr.Max.Q; x0 += gr.Len.Q * 0.005)
                    {
                        chart1.Series["Лін Рег" + ":" + CRA.RegresTypeVib].Points.AddXY(x0, CRA.Q[3].Q + CRA.Q[4].Q * Correlation_RegressionAnalysis.fi1F(x0, gr.Mx.Q)
                                                                                        + CRA.Q[5].Q * Correlation_RegressionAnalysis.fi2F(x0, gr.Dx.Q, gr.Mx.Q, x2, x3));
                    }
                }
            }
        }