コード例 #1
0
        private static IList <double> GetFrequency(StatisticalInput statisticalInput, IList <double> simulatedValues)
        {
            double         lowerBound = -1;
            double         upperBound = 0;
            IList <double> binSizes   = GetBinSizes(statisticalInput.FitMaxValue, statisticalInput.FitMinValue, statisticalInput.Interval);
            List <double>  result     = new List <double>();
            int            dataNum    = statisticalInput.Iteration - statisticalInput.Interval;

            for (int i = 0; i < statisticalInput.Iteration - dataNum; i++)
            {
                int frequency = 0;
                upperBound = binSizes[i];

                for (int j = 0; j < statisticalInput.Iteration; j++)
                {
                    if (simulatedValues[j] > lowerBound && simulatedValues[j] <= upperBound)
                    {
                        frequency += 1;
                    }
                }
                result.Add(frequency);
                lowerBound = upperBound;
            }
            return(result);
        }
コード例 #2
0
        internal static IList <double> GetExpectation(StatisticalInput statisticalInput, IList <double> simulatedValues)
        {
            var            result = new List <double>();
            IList <double> reletivefrequencies = GetRelFrequency(statisticalInput, simulatedValues);
            IList <double> cumfrequencies      = GetCumFrequency(statisticalInput, simulatedValues);

            for (int i = 0; i < statisticalInput.Interval; i++)
            {
                result.Add(cumfrequencies[i] - reletivefrequencies[i]);
            }
            return(result);
        }
コード例 #3
0
        public static IList <double> GetRelFrequency(StatisticalInput statisticalInput, IList <double> simulatedValues)
        {
            var            result      = new List <double>();
            IList <double> frequencies = GetFrequency(statisticalInput, simulatedValues);
            double         sum         = frequencies.Sum();

            for (int i = 0; i < statisticalInput.Interval; i++)
            {
                double relf = frequencies[i] / sum;
                result.Add(relf);
            }
            return(result);
        }