Example #1
0
        private void btnRefreshIntervalVariationRow_Click(object sender, EventArgs e)
        {
            var ivRow = new IntervalVariationRow(variationRow, (int)nudIntervalsCount.Value);

            FillIntervalVariationTable(ivRow);

            DrawHistogram(ivRow, dataItems);
        }
Example #2
0
        // Критерій згоди Пірсона χ2
        public static double GetPirsonCriteria(IntervalVariationRow intervalVariationRow, double m, double sigma)
        {
            double pirsonCriteria = 0;
            int    N = intervalVariationRow.N;

            foreach (var intervalVariant in intervalVariationRow.IntervalVariants)
            {
                var ni0 = GetTeoreticalFrequency(intervalVariant, N, m, sigma);
                pirsonCriteria += ((intervalVariant.Frequency - ni0) * (intervalVariant.Frequency - ni0))
                                  / ni0;
            }

            return(pirsonCriteria);
        }
Example #3
0
        private void FillIntervalVariationTable(IntervalVariationRow ivRow)
        {
            gvIntervalVariationRow.Rows.Clear();

            foreach (var variant in ivRow.IntervalVariants)
            {
                var rowIndex = gvIntervalVariationRow.Rows.Add();

                gvIntervalVariationRow.Rows[rowIndex].HeaderCell.Value                   = String.Format("{0}", rowIndex + 1);
                gvIntervalVariationRow.Rows[rowIndex].Cells["Interval"].Value            = $"{variant.Interval.Item1.ToString("#.###")} - {variant.Interval.Item2.ToString("#.###")}";
                gvIntervalVariationRow.Rows[rowIndex].Cells["Freq"].Value                = variant.Frequency;
                gvIntervalVariationRow.Rows[rowIndex].Cells["RelFreq"].Value             = String.Format("{0:0.###}", variant.RelativeFrequency);
                gvIntervalVariationRow.Rows[rowIndex].Cells["cummulatedFrequency"].Value = String.Format("{0:0.###}", variant.CummulatedFrequenct);
                gvIntervalVariationRow.Rows[rowIndex].Cells["DispFunc"].Value            = String.Format("{0:0.###}", variant.EmpericalFunction);
            }
        }
Example #4
0
        private void FillAllData(List <double> dataItems)
        {
            variationRow = new VariationRow(dataItems);

            FillVariationTable(variationRow);
            DrawEmpericalChart(variationRow.Variants);

            lblStegesClassesCount.Text = Formulas.GetNumberOfClasses(dataItems.Count).ToString();
            nudIntervalsCount.Value    = Formulas.GetNumberOfClasses(variationRow.DataCount);

            iVariationRow = new IntervalVariationRow(variationRow, (int)nudIntervalsCount.Value);

            FillIntervalVariationTable(iVariationRow);
            DrawHistogram(iVariationRow, dataItems);

            FillCharacteristicsGrid(dataItems, dgvCharacteristics);
        }
Example #5
0
        private void DrawHistogram(IntervalVariationRow ivRow, List <double> data)
        {
            crtIntervalRow.Series["Frequency"].Points.Clear();
            crtIntervalRow.Series["Frequency"]["PointWidth"] = "1";

            crtIntervalRow.Series["ProbabilityDensity"].Points.Clear();
            crtIntervalRow.Series["ProbabilityDensity"].BorderWidth = 2;

            var m     = StatCharacteristicModel.Average.GetAverage(data);
            var sigma = StatCharacteristicModel.StandartDeviationNotSkew.GetValue(data);

            foreach (var iVariant in ivRow.IntervalVariants)
            {
                crtIntervalRow.Series["Frequency"].Points.AddXY(iVariant.Interval.Item1.ToString("#.###"), iVariant.RelativeFrequency);

                var x = (iVariant.Interval.Item1 + iVariant.Interval.Item2) / 2;
                var probabilityDensity = ivRow.h * NormalDistribution.ProbabilityDensity(x, m, sigma);
                crtIntervalRow.Series["ProbabilityDensity"].Points.AddXY(x.ToString("#.###"), probabilityDensity);
            }
        }