public static double GetEmpericalFunctionValue(double x, VariationRow variationRow) { double empericalValue = 0; var variants = variationRow.Variants; if (x > variants[variants.Count - 1].Value) { empericalValue = 1; } else { for (int i = 0; i < variants.Count; i++) { if (x <= variants[i].Value) // X <= Xi { for (int j = 0; j < i; j++) { empericalValue += variants[j].Frequency; } empericalValue /= variationRow.DataCount; break; } } } return(empericalValue); }
public static double GetStep(VariationRow variationRow, int intervalsNumber) { var maxValue = variationRow.Variants.OrderByDescending(variant => variant.Value).First().Value; var minValue = variationRow.Variants.OrderBy(variant => variant.Value).First().Value; return((maxValue - minValue) / intervalsNumber); // Размах вариации / количество классов (интервалов) }
private void FillVariationTable(VariationRow variationRow) { gvVariationRow.Rows.Clear(); for (int i = 0; i < variationRow.Variants.Count; i++) { var rowIndex = gvVariationRow.Rows.Add(); var variant = variationRow.Variants[i]; gvVariationRow.Rows[rowIndex].HeaderCell.Value = String.Format("{0}", rowIndex + 1); gvVariationRow.Rows[rowIndex].Cells["Value"].Value = variant.Value; gvVariationRow.Rows[rowIndex].Cells["Frequency"].Value = variant.Frequency; gvVariationRow.Rows[rowIndex].Cells["RelativeFrequency"].Value = String.Format("{0:0.###}", variant.RelativeFrequency); gvVariationRow.Rows[rowIndex].Cells["cumFreq"].Value = String.Format("{0:0.###}", variant.CummulatedFrequency); gvVariationRow.Rows[rowIndex].Cells["DistributionFunction"].Value = String.Format("{0:0.###}", variant.EmpericalFunction); } }
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); }