예제 #1
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)));
        }
예제 #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 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));
        }
예제 #3
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)));
        }
예제 #4
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));
 }