// derived values


        /// <summary>
        ///   Constructs a F-distribution with
        ///   the given degrees of freedom.
        /// </summary>
        /// <param name="degrees1">The first degree of freedom.</param>
        /// <param name="degrees2">The second degree of freedom.</param>
        public FDistribution(int degrees1, int degrees2)
        {
            d1 = degrees1;
            d2 = degrees2;

            b = Special.Beta(degrees1 * 0.5, degrees2 * 0.5);
        }
示例#2
0
        /// <summary>
        ///   Constructs a F-distribution with
        ///   the given degrees of freedom.
        /// </summary>
        ///
        /// <param name="degrees1">The first degree of freedom.</param>
        /// <param name="degrees2">The second degree of freedom.</param>
        ///
        public FDistribution(int degrees1, int degrees2)
        {
            this.d1 = degrees1;
            this.d2 = degrees2;

            this.b = Special.Beta(degrees1 * 0.5, degrees2 * 0.5);
        }
示例#3
0
文件: FisherZ.cs 项目: asiryan/UMapx
        /// <summary>
        /// Returns the value of the probability density function.
        /// </summary>
        /// <param name="x">Value</param>
        /// <returns>float precision floating point number</returns>
        public float Function(float x)
        {
            // helpers:

            float d12 = d1 / 2.0f;
            float d22 = d2 / 2.0f;

            // first equation:

            float a = (float)Math.Pow(d1, d12);
            float b = (float)Math.Pow(d2, d22);
            float c = 2 * a * b;
            float d = Special.Beta(d12, d22);
            float e = c / d;

            // second equation:

            float f = (float)Math.Exp(d1 * x);
            float g = d1 * (float)Math.Exp(2 * x) + d2;
            float h = d12 + d22;
            float j = f / (float)Math.Pow(g, h);

            // result of F(x, d1, d2):
            return(e * j);
        }
示例#4
0
文件: Beta.cs 项目: asiryan/UMapx
 /// <summary>
 /// Returns the value of the probability distribution function.
 /// </summary>
 /// <param name="x">Value</param>
 /// <returns>float precision floating point number</returns>
 public float Distribution(float x)
 {
     if (x > 1)
     {
         return(0);
     }
     else if (x < 0)
     {
         return(0);
     }
     return(Special.Beta(a, b, x));
 }
示例#5
0
文件: Beta.cs 项目: asiryan/UMapx
 /// <summary>
 /// Returns the value of the probability density function.
 /// </summary>
 /// <param name="x">Value</param>
 /// <returns>float precision floating point number</returns>
 public float Function(float x)
 {
     if (x > 1)
     {
         return(0);
     }
     else if (x < 0)
     {
         return(0);
     }
     return((float)Math.Pow(x, a - 1) * (float)Math.Pow(1 - x, b - 1) / Special.Beta(a, b));
 }
示例#6
0
        /// <summary>
        /// Returns the value of the probability density function.
        /// </summary>
        /// <param name="x">Value</param>
        /// <returns>float precision floating point number</returns>
        public float Function(float x)
        {
            if (x <= 0)
            {
                return(0);
            }

            float num = (float)Math.Pow(x, alpha - 1) * (float)Math.Pow(1 + x, -alpha - beta);
            float den = Special.Beta(alpha, beta);

            return(num / den);
        }
示例#7
0
 /// <summary>
 /// Returns the value of the probability distribution function.
 /// </summary>
 /// <param name="x">Value</param>
 /// <returns>float precision floating point number</returns>
 public float Distribution(float x)
 {
     if (x <= 0)
     {
         return(0);
     }
     if (x > 1)
     {
         return(0);
     }
     return(1 + Special.Beta(x + 1, 0) / (float)Math.Log(1 - p));
 }
示例#8
0
        /// <summary>
        /// Returns the value of the probability distribution function.
        /// </summary>
        /// <param name="x">Value</param>
        /// <returns>float precision floating point number</returns>
        public float Distribution(float x)
        {
            if (x < 0)
            {
                return(0);
            }
            if (x >= n)
            {
                return(1);
            }

            float a = n - x;
            float b = x + 1;

            return(Special.Beta(a, b, q));
        }
示例#9
0
        /// <summary>
        /// Initializes the Fisher distribution.
        /// </summary>
        /// <param name="d1">First degree of freedom</param>
        /// <param name="d2">Second degree of freedom</param>
        public FisherSnedecor(int d1 = 1, int d2 = 1)
        {
            if (d1 <= 0)
            {
                throw new ArgumentOutOfRangeException("d1", "The value must be greater than zero.");
            }
            if (d2 <= 0)
            {
                throw new ArgumentOutOfRangeException("d2", "The value must be greater than zero.");
            }

            this.d1 = d1;
            this.d2 = d2;

            this.b = Special.Beta(d1 * 0.5f, d2 * 0.5f);
        }
示例#10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="n"></param>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 protected static float momentGeneratingFunction(int n, float a, float b)
 {
     return(b * Special.Beta(1.0f + ((float)n) / a, b));
 }