Ejemplo n.º 1
0
        //private void BtnOpenFile_Click(object sender, RoutedEventArgs e)
        //{
        //    OpenFileDialog FileOT = new OpenFileDialog();
        //    FileOT.Filter = "All files (*.*)|*.*|TXT text (*.txt)|*.txt";
        //    if (FileOT.ShowDialog() == true)
        //    {
        //        Stream ms = new FileStream(FileOT.FileName, FileMode.Open);
        //        lblNameFile.Content = FileOT.FileName;
        //        byte[] array = new byte[ms.Length];
        //        ms.Read(array, 0, array.Length);
        //        string buf = Encoding.Default.GetString(array);
        //        s = buf.ToLower();
        //    }
        //    sampleSource = DiscriptiveStatistics.GetSample(s);
        //    tbDiscrStat_source.Text = DiscriptiveStatistics.Output_descriptive_statistics(sampleSource);
        //    tblSourceSample.Text = DiscriptiveStatistics.Output(sampleSource);
        //}
        //private void BtnRationing_Click(object sender, RoutedEventArgs e)
        //{
        //    try
        //    {
        //        sampleRationing = DiscriptiveStatistics.Rationing_MaxMin(sampleSource);
        //        tblRationning.Text = DiscriptiveStatistics.Output(sampleRationing);
        //        tbDiscrStat_Ration.Text = DiscriptiveStatistics.Output_descriptive_statistics(sampleRationing);
        //    }
        //    catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка"); }
        //}
        //private void BtnSaveFile_Click(object sender, RoutedEventArgs e)
        //{
        //    SaveFileDialog sd = new SaveFileDialog();
        //    sd.Filter = "All files (*.*)|*.*|TXT text (*.txt)|*.txt";
        //    if (sd.ShowDialog() == true)
        //    {
        //        File.WriteAllText(sd.FileName, DiscriptiveStatistics.Save(sampleRationing));
        //    }
        //}

        #endregion

        #region  аспределение
        private double[] Get_theretical_frequency_Laplas(double[] arr, double[][] intervalArray)
        {
            double X_aver = DiscriptiveStatistics.Average(arr);
            double disp   = Math.Sqrt(DiscriptiveStatistics.Dispersion(arr));

            double[] P = new double[intervalArray.Length];
            for (int i = 0; i < P.Length; i++)
            {
                double[] buf = intervalArray[i];
                P[i]  = DiscriptiveStatistics.GetValueLaplasFunction(Math.Round(Math.Abs((buf[0] - X_aver) / disp), 2)) * DiscriptiveStatistics.GetValueLaplasFunction(Math.Round(Math.Abs((buf[buf.Length - 1] - X_aver) / disp), 2));
                P[i] *= buf.Length;
            }
            return(P);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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
         });
     }
 }