/// <summary>
        /// Cumulative Density Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/>
        /// <seealso cref="https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function"/>
        public override double Cdf(double x)
        {
            if (x < 0 || x > 1.0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be in [0..1] range");
            }

            return(GammaFunctions.BetaIncompleteRegular(x, Alpha, Beta));
        }
Example #2
0
        /// <summary>
        /// Cumulative Density Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/>
        public override double Cdf(double x)
        {
            if (x < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must not be negative");
            }

            return(1.0 - GammaFunctions.BetaIncompleteRegular(DegreeOfFreedom / (x * x + DegreeOfFreedom), DegreeOfFreedom / 2, 0.5) / 2);
        }
Example #3
0
        /// <summary>
        /// Cumulative Density Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/>
        public override double Cdf(double x)
        {
            if (x <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be positive");
            }

            return(GammaFunctions.GammaLowRegular(DegreeOfFreedom / 2, x / 2));
        }
        /// <summary>
        /// Probability Distribution Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/>
        /// <seealso cref="https://proofwiki.org/wiki/Binomial_Coefficient_expressed_using_Beta_Function"/>
        public override double Pdf(double x)
        {
            if (x < 0.0 || x > Count)
            {
                return(0);
            }

            double coef = 1.0 / (x + 1) / GammaFunctions.BetaFunc(x + 1, Count - x + 1);

            return(coef * Math.Pow(P, x) * Math.Pow(Q, Count - x));
        }
Example #5
0
        /// <summary>
        /// Cumulative Density Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/>
        public override double Cdf(double x)
        {
            if (x <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be positive");
            }

            return(GammaFunctions.BetaIncompleteRegular(DegreeOfFreedom1 * x / (DegreeOfFreedom1 * x + DegreeOfFreedom2),
                                                        DegreeOfFreedom1 / 2,
                                                        DegreeOfFreedom2 / 2));
        }
Example #6
0
        /// <summary>
        /// Probability Distribution Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/>
        public override double Pdf(double x)
        {
            if (x <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be positive");
            }

            return(Math.Sqrt(Math.Pow(DegreeOfFreedom1 * x, DegreeOfFreedom1) *
                             Math.Pow(DegreeOfFreedom2, DegreeOfFreedom2) /
                             Math.Pow(DegreeOfFreedom1 * x + DegreeOfFreedom2, DegreeOfFreedom1 + DegreeOfFreedom2)) /
                   (x * GammaFunctions.BetaFunc(DegreeOfFreedom1 / 2, DegreeOfFreedom2 / 2)));
        }
        /// <summary>
        /// Probability Distribution Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/>
        public override double Pdf(double x)
        {
            if (x < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be non negative");
            }
            else if (x == 0)
            {
                return(0.0);
            }

            return(Math.Pow(Rate, x) * Math.Exp(-Rate) / GammaFunctions.Factorial(x));
        }
        /// <summary>
        /// Cumulative Density Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/>
        public override double Cdf(double x)
        {
            if (x <= 0)
            {
                return(0.0);
            }
            else if (x >= Count)
            {
                return(1.0);
            }

            return(GammaFunctions.BetaIncomplete(Q, Count - x, x + 1));
        }
        /// <summary>
        /// Cumulative Density Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/>
        public override double Cdf(double x)
        {
            if (x <= A)
            {
                return(0.0);
            }
            else if (x >= C)
            {
                return(1.0);
            }

            return(GammaFunctions.BetaIncomplete((x - A) / (C - A), Alpha, Beta));
        }
Example #10
0
        /// <summary>
        /// Probability Distribution Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/>
        public override double Pdf(double x)
        {
            if (x < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be non negative");
            }
            else if (x == 0)
            {
                return(Shape <= 1 ? double.PositiveInfinity : 0.0);
            }

            return(Math.Pow(x, Shape - 1) *
                   Math.Exp(-x / Scale) /
                   (GammaFunctions.Gamma(Shape) * Math.Pow(Scale, Shape)));
        }
        /// <summary>
        /// Probability Distribution Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/>
        /// <seealso cref="https://proofwiki.org/wiki/Binomial_Coefficient_expressed_using_Beta_Function"/>
        public override double Pdf(double x)
        {
            if (x <= A)
            {
                return(0.0);
            }
            else if (x >= C)
            {
                return(0.0);
            }

            return(Math.Pow(x - A, Alpha - 1) *
                   Math.Pow(C - x, Beta - 1) /
                   GammaFunctions.BetaFunc(Alpha, Beta) /
                   Math.Pow(C - A, Alpha + Beta - 1));
        }
Example #12
0
        /// <summary>
        /// Cumulative Density Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/>
        public override double Cdf(double x)
        {
            if (x < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be positive");
            }
            else if (x == 0)
            {
                return(0.0);
            }
            else if (double.IsPositiveInfinity(x))
            {
                return(1.0);
            }

            return(GammaFunctions.GammaLow(Shape, x / Scale) / GammaFunctions.Gamma(Shape));
        }
        /// <summary>
        /// Cumulative Density Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/>
        public override double Cdf(double x)
        {
            if (x < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be positive");
            }
            else if (x == 0)
            {
                return(0.0);
            }
            else if (double.IsPositiveInfinity(x))
            {
                return(1.0);
            }

            return(GammaFunctions.GammaHigh(x + 1, Rate) / GammaFunctions.Factorial(x));
        }
        /// <summary>
        /// Probability Distribution Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/>
        public override double Pdf(double x)
        {
            if (x < 0 || x > 1.0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be in [0..1] range");
            }

            if (Alpha == Beta && Alpha == 1)
            {
                return(1.0);
            }

            if (x == 0)
            {
                return(Alpha <= 1 ? double.PositiveInfinity : 0.0);
            }
            else if (x == 1)
            {
                return(Beta <= 1 ? double.PositiveInfinity : 0.0);
            }

            return(Math.Pow(x, Alpha - 1.0) * Math.Pow(1.0 - x, Beta - 1.0) / GammaFunctions.BetaFunc(Alpha, Beta));
        }
Example #15
0
        /// <summary>
        /// Probability Distribution Function
        /// </summary>
        /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/>
        public override double Pdf(double x)
        {
            if (x <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "value must be positive");
            }

            return(Math.Pow(x, DegreeOfFreedom / 2 - 1) * Math.Exp(-x / 2) / (Math.Pow(2, DegreeOfFreedom / 2) * GammaFunctions.Gamma(DegreeOfFreedom / 2)));
        }
Example #16
0
 /// <summary>
 /// Probability Distribution Function
 /// </summary>
 /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/>
 public override double Pdf(double x)
 {
     return(GammaFunctions.Gamma((DegreeOfFreedom + 1) / 2) / (Math.Sqrt(DegreeOfFreedom * Math.PI) * GammaFunctions.Gamma(DegreeOfFreedom / 2)) *
            Math.Pow(1 + x * x / DegreeOfFreedom, -(DegreeOfFreedom + 1) / 2));
 }