Пример #1
0
        public void BuildChart2(Chart chart)
        {
            chart.Series.Clear();

            double X1 = X.Max();
            double Y1 = GetEmpRegrYonX() * (X1 - Statistic.GetAverStatic(X)) + Statistic.GetAverStatic(Y);
            double X2 = X.Min();
            double Y2 = GetEmpRegrYonX() * (X2 - Statistic.GetAverStatic(X)) + Statistic.GetAverStatic(Y);

            chart.Series.Add("YonX");
            chart.Series["YonX"].BorderWidth = 3;
            chart.Series["YonX"].ChartType   = SeriesChartType.Line;
            chart.Series["YonX"].Points.AddXY(Math.Round(X1, ROUND_DIGITS), Math.Round(Y1, ROUND_DIGITS));
            chart.Series["YonX"].Points.AddXY(Math.Round(X2, ROUND_DIGITS), Math.Round(Y2, ROUND_DIGITS));


            Y1 = Y.Max();
            X1 = GetEmpRegrXonY() * (Y1 - Statistic.GetAverStatic(Y)) + Statistic.GetAverStatic(X);
            Y2 = Y.Min();
            X2 = GetEmpRegrXonY() * (Y2 - Statistic.GetAverStatic(Y)) + Statistic.GetAverStatic(X);
            chart.Series.Add("XonY");
            chart.Series["XonY"].BorderWidth = 3;
            chart.Series["XonY"].ChartType   = SeriesChartType.Line;
            chart.Series["XonY"].Points.AddXY(Math.Round(X1, ROUND_DIGITS), Math.Round(Y1, ROUND_DIGITS));
            chart.Series["XonY"].Points.AddXY(Math.Round(X2, ROUND_DIGITS), Math.Round(Y2, ROUND_DIGITS));
        }
Пример #2
0
 public Correlation(double[] x, double[] y)
 {
     X         = (double[])x.Clone();
     Y         = (double[])y.Clone();
     XAverStat = Statistic.GetAverStatic(X);
     YAverStat = Statistic.GetAverStatic(Y);
     Sx        = Statistic.GetMeanSqrDeviation(X);
     Sy        = Statistic.GetMeanSqrDeviation(Y);
 }
Пример #3
0
        public static double GetCov(double[] X, double[] Y)
        {
            double COVxy = 0;

            for (int i = 0; i < X.Length && i < Y.Length; ++i)
            {
                COVxy += (X[i] - Statistic.GetAverStatic(X)) * (Y[i] - Statistic.GetAverStatic(Y)) / X.Length;
            }
            return(COVxy);
        }
Пример #4
0
 public double[] GetIntersectionPoint2()
 {
     double[] Point = new double[2];
     if ((1 - GetEmpRegrXonY() * GetEmpRegrYonX()) != 0)
     {
         Point[0] = (Statistic.GetAverStatic(X) - Statistic.GetAverStatic(X) * GetEmpRegrYonX() * GetEmpRegrXonY()) / (1 - GetEmpRegrXonY() * GetEmpRegrYonX());
         Point[1] = GetEmpRegrXonY() * (Point[0] - Statistic.GetAverStatic(X)) + Statistic.GetAverStatic(Y);
         return(Point);
     }
     else
     {
         return(null);
     }
 }
Пример #5
0
 public string GetXYEquation()
 {
     return(String.Format("x* - {0} = {1} ( y* - {2} )", Math.Round(Statistic.GetAverStatic(X), ROUND_DIGITS), Math.Round(GetEmpRegrXonY(), ROUND_DIGITS), Math.Round(Statistic.GetAverStatic(Y), ROUND_DIGITS)));
 }
Пример #6
0
        public static void FillDSRGrid(double[] Elements, System.Windows.Forms.DataGridView Grid)
        {
            CRow Row = new CRow(new List <double>(Elements));

            int Length = Row.UniqLength();

            Grid.ColumnCount = 2 + Elements.Length;

            Grid.Rows.Clear();
            string[] row = new string[Grid.ColumnCount];
            row[0] = "x";
            for (int i = 0; i < Length; ++i)
            {
                row[i + 1] = Row.Elements[i].numb.ToString();
            }
            Grid.Rows.Add(row);


            row[0] = "m";
            for (int i = 0; i < Length; ++i)
            {
                row[i + 1] = Row.Elements[i].frequency.ToString();
            }
            Grid.Rows.Add(row);

            row[0] = "p*";
            for (int i = 0; i < Length; ++i)
            {
                row[i + 1] = Math.Round(Row.Elements[i].rel_frequency, LabToolz.ROUND_DIGITS).ToString();
            }
            Grid.Rows.Add(row);

            row[0] = "acum(m)";
            for (int i = 0; i < Length; ++i)
            {
                row[i + 1] = Row.Elements[i].acum_freq.ToString();
            }
            Grid.Rows.Add(row);

            row[0] = "acum(p*)";
            for (int i = 0; i < Length; ++i)
            {
                row[i + 1] = Math.Round(Row.Elements[i].acum_rel_freq, LabToolz.ROUND_DIGITS).ToString();
            }

            string[] row2 = { " " };
            Grid.Rows.Add(row2);

            row[0] = "x - averstat(x)";
            double sum      = 0;
            double averstat = Statistic.GetAverStatic(Elements);

            for (int i = 0; i < Length; ++i)
            {
                sum       += Row.Elements[i].numb - averstat;
                row[i + 1] = (Row.Elements[i].numb - averstat).ToString();
            }
            row[Length + 1] = "SUM=" + sum;
            Grid.Rows.Add(row);

            row[0]   = "(x - averstat(x))^2";
            sum      = 0;
            averstat = Statistic.GetAverStatic(Elements);
            for (int i = 0; i < Length; ++i)
            {
                sum       += (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat);
                row[i + 1] = ((Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat)).ToString();
            }
            row[Length + 1] = "SUM=" + sum;
            Grid.Rows.Add(row);

            row[0]   = "(x - averstat(x))^3";
            sum      = 0;
            averstat = Statistic.GetAverStatic(Elements);
            for (int i = 0; i < Length; ++i)
            {
                sum       += (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat);
                row[i + 1] = ((Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat)).ToString();
            }
            row[Length + 1] = "SUM=" + sum;
            Grid.Rows.Add(row);

            row[0]   = "(x - averstat(x))^4";
            sum      = 0;
            averstat = Statistic.GetAverStatic(Elements);
            for (int i = 0; i < Length; ++i)
            {
                sum       += (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat);
                row[i + 1] = ((Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat) * (Row.Elements[i].numb - averstat)).ToString();
            }
            row[Length + 1] = "SUM=" + sum;
            Grid.Rows.Add(row);

            Grid.Rows.Add(row2);

            row[0] = "x";
            row[1] = "[-intf;" + Row.Elements[0].numb.ToString() + ")";

            for (int i = 1; i < Length; ++i)
            {
                row[i + 1] = "[ " + Row.Elements[i - 1].numb.ToString() + ";" + Row.Elements[i].numb.ToString() + ")";
            }
            row[Length + 1] = "[ " + Row.Elements[Length - 1].numb.ToString() + ";+ inf]";
            Grid.Rows.Add(row);

            row[0] = "F*(x)";
            row[1] = "0";
            for (int i = 1; i < Length; ++i)
            {
                row[i + 1] = Math.Round(Row.Elements[i - 1].acum_rel_freq, LabToolz.ROUND_DIGITS).ToString();
            }
            row[Length + 1] = "1";
            Grid.Rows.Add(row);


            for (int i = 0; i < Grid.Columns.Count; ++i)
            {
                DataGridViewColumn column = Grid.Columns[i];
                column.Width = 80;
            }
        }