private double[] point(double[] arr, int CountInterval)
        {
            double max = DiscriptiveStatistics.Max(arr);
            double min = DiscriptiveStatistics.Min(arr);

            double[] points = new double[CountInterval + 1];
            for (int i = 0; i < points.Length; i++)
            {
                points[i] = max - i * (max - min) / CountInterval;
            }

            return(points.OrderBy(x => x).ToArray());
        }
        private double[] theoretical_freq(double[] arr, double sum, double[] xn, int CountInterval)
        {
            double X_aver = DiscriptiveStatistics.Average(arr);
            double disp   = Math.Sqrt(DiscriptiveStatistics.Dispersion(arr));

            double[] m_t = new double[CountInterval];
            double   h   = (DiscriptiveStatistics.Max(arr) - DiscriptiveStatistics.Min(arr)) / CountInterval;

            for (int i = 0; i < m_t.Length; i++)
            {
                double u   = (xn[i] - X_aver) / disp;
                double f_u = 1 / (Math.Sqrt(2 * Math.PI) * Math.Pow(Math.E, (u * u) / 2));
                m_t[i] = sum * h / disp * f_u;
            }
            return(m_t);
        }
        private void err()
        {
            double srErr = 0;

            tb.Text = "";
            for (int i = 0; i < colum; i++)
            {
                double   t    = 2.5;
                double[] buf  = columArray[i];
                double   disp = DiscriptiveStatistics.Dispersion(buf);
                srErr += DiscriptiveStatistics.StandartError(buf);
                double err  = Math.Sqrt(disp / buf.Length);
                double err2 = t * err;
                double n    = t * t * disp * buf.Length / (err2 * err2 * buf.Length + t * t * disp);
                tb.Text += i + "\tn = " + n + "\tсред.ош. = " + err + "\tпредел.ош. = " + err2 + "\n";
            }
            srErr   /= colum;
            tb.Text += "\nСредняя ошибка: " + srErr;
        }
 private void output(double[][] arr)
 {
     for (int i = 0; i < colum; i++)
     {
         string s = "";
         string t = "";
         s += (i + 1).ToString() + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Average(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Amount(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.StandartError(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Median(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Fashion(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.StandartDeviation(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Dispersion(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Excess(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Asymmetry(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Interval(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Min(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", DiscriptiveStatistics.Max(arr[i])) + "\n\n";
         t += "\t\n\n\n";
         s += string.Format("{0:F2}", arr[i].Length) + "\n\n";
         t += "\t\n\n\n";
         stpDiscrStat.Children.Add(new TextBlock {
             Text = s
         });
         stpDiscrStat.Children.Add(new TextBlock {
             Text = t
         });
     }
 }
        private void BtnDATA_Click()
        {
            Data.GetCsv();
            columArraySource = Data.Array;
            columArray       = new double[Data.parametrs.Count][];
            colum            = Data.parametrs.Count;
            for (int i = 0; i < colum; i++)
            {
                columArray[i] = DiscriptiveStatistics.Rationing_MaxMin(columArraySource[i]);
            }
            StackPanel stp = new StackPanel();

            stp.Orientation = Orientation.Horizontal;
            for (int i = 0; i < Data.Array.Length; i++)
            {
                double[]  buf = Data.Array[i];
                TextBlock lv  = new TextBlock();
                lv.Width  = 100;
                lv.Height = Data.Array[0].Length * 18;
                lv.Text  += Data.parametrs[i] + "\n";
                for (int j = 0; j < buf.Length; j++)
                {
                    lv.Text += buf[j] + "\n";
                }
                stp.Children.Add(lv);
            }
            scv.Content = stp;

            string s = "";

            for (int j = 0; j < columArray[0].Length; j++)
            {
                for (int i = 0; i < colum; i++)
                {
                    s += columArray[i][j] + " ";
                }
                s += "\n";
            }
            tb.Text = s;
        }
        private void Pair()
        {
            try
            {
                koeffPair = new DenseMatrix(colum, colum);
                for (int i = 0; i < colum; i++)
                {
                    for (int j = i; j < colum; j++)
                    {
                        koeffPair[i, j] = koeffPair[j, i] = DiscriptiveStatistics.PairKoeff(columArray[i], columArray[j]);
                    }
                }

                DenseMatrix t_Matrix = T_Matrix_Koeff(koeffPair);

                tbMatrix.Text  = Output_R(koeffPair);
                tbMatrix.Text += "Коэффициент значим при t > 1.96 (з - значим, н - не значим)\n";

                string s = "\t";
                for (int i = 0; i < colum; i++)
                {
                    s += (i + 1).ToString() + "\t";
                }
                s += "\n\n";
                for (int i = 0; i < colum; i++)
                {
                    s += (i + 1).ToString() + "\t";
                    for (int j = 0; j < colum; j++)
                    {
                        if (t_Matrix[i, j] > t_tabl)
                        {
                            s += "з\t";
                        }
                        else
                        {
                            s += "н\t";
                        }
                    }
                    s += "\n\n";
                }
                s             += "\n\n";
                tbMatrix.Text += s;
                #region Окружность
                var X_Y = new List <KeyValuePair <double, double> >()
                {
                    new KeyValuePair <double, double>(150, 0),
                    new KeyValuePair <double, double>(250, 40),

                    new KeyValuePair <double, double>(270, 90),
                    new KeyValuePair <double, double>(270, 190),

                    new KeyValuePair <double, double>(250, 250),
                    new KeyValuePair <double, double>(150, 295),

                    new KeyValuePair <double, double>(40, 250),
                    new KeyValuePair <double, double>(10, 190),

                    new KeyValuePair <double, double>(10, 90),
                    new KeyValuePair <double, double>(40, 40)
                };
                foreach (KeyValuePair <double, double> x in X_Y)
                {
                    Ellipse l = new Ellipse();
                    l.Width = l.Height = 5;
                    l.Fill  = Brushes.Red;
                    Canvas.SetTop(l, x.Value);
                    Canvas.SetLeft(l, x.Key);
                    cnvMain.Children.Add(l);
                }
                for (int i = 0; i < colum; i++)
                {
                    for (int j = i + 1; j < colum; j++)
                    {
                        if (i != j && koeffPair[i, j] >= 0.3 && koeffPair[i, j] < 0.5)
                        {
                            Line l = new Line();
                            l.X1              = X_Y[i].Key;
                            l.X2              = X_Y[j].Key;
                            l.Y1              = X_Y[i].Value;
                            l.Y2              = X_Y[j].Value;
                            l.Stroke          = Brushes.Red;
                            l.StrokeThickness = 1;
                            cnvMain.Children.Add(l);
                        }
                        if (i != j && koeffPair[i, j] >= 0.5 && koeffPair[i, j] < 0.7)
                        {
                            Line l = new Line();
                            l.X1              = X_Y[i].Key;
                            l.X2              = X_Y[j].Key;
                            l.Y1              = X_Y[i].Value;
                            l.Y2              = X_Y[j].Value;
                            l.Stroke          = Brushes.Yellow;
                            l.StrokeThickness = 1;
                            cnvMain.Children.Add(l);
                        }
                        if (i != j && koeffPair[i, j] >= 0.7 && koeffPair[i, j] < 1)
                        {
                            Line l = new Line();
                            l.X1              = X_Y[i].Key;
                            l.X2              = X_Y[j].Key;
                            l.Y1              = X_Y[i].Value;
                            l.Y2              = X_Y[j].Value;
                            l.Stroke          = Brushes.Green;
                            l.StrokeThickness = 1;
                            cnvMain.Children.Add(l);
                        }
                    }
                }
                #endregion
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка"); }
        }