BiasCorrectQ.Utils.ComputeCDF C# (CSharp) Method

ComputeCDF() static private method

static private ComputeCDF ( List values, List &sorted_values ) : List
values List
sorted_values List
return List
        internal static List<double> ComputeCDF(List<double> values,
            out List<double> sorted_values)
        {
            var rval = new List<double> { };

            //copy values and sort
            var vals = new List<double>(values);
            vals.Sort();
            vals.Reverse();
            sorted_values = vals;

            int count = 1;
            foreach (var val in vals)
            {
            /* Statistical Downscaling Techniques for Global Climate Model
             * Simulations of Temperature and Precipitation with Application to
             * Water Resources Planning Studies
             *     Alan F. Hamlet
             *     Eric P. Salathé
             *     Pablo Carrasco
             *
             * unbiased quantile estimator is used to assign a plotting
             * position to the data based on the Cunnane formulation
             * (Stedinger et al. 1993):15€
             *     q = (i − 0.4) / (n + 0.2)
             * where q is the estimated quantile (or probability of exceedance)
             * for the data value of rank position i (rank position 1 is the highest value),
             * for a total sample size of n */
            rval.Add((count - 0.4) / (vals.Count + 0.2));
            count++;
            }

            return rval;
        }

Usage Example

Example #1
0
        public AnnualCDF(List <Point> points)
        {
            var values = Utils.GetWYAnnualAverages(points);

            List <double> sorted_values;
            var           cdf = Utils.ComputeCDF(values, out sorted_values);

            Probability = cdf;
            Flow        = sorted_values;
            LNfit       = new LNFit(values);
        }
All Usage Examples Of BiasCorrectQ.Utils::ComputeCDF