예제 #1
0
 /// <summary>
 /// This function return the cummulative distribution function (CDF)
 /// for ChiSquare Distribution where X2 from 0 t x2 and
 /// number degree of freedom k.
 /// </summary>
 /// <param name="x2">double. x2</param>
 /// <param name="k">int. k is number degree of freedom</param>
 /// <returns>
 /// The value of cummulative distribution function (CDF)
 /// for ChiSquare Distribution where X2 form 0 t x2 and
 /// number degree of freedom k.
 /// </returns>
 public static double CDF(double x2, int k)
 {
     // the number degree of freedom must be
     // more or equal than 1. The value of x must be
     // not less than 0
     if (k < 1 || x2 < 0) return double.NaN;
     ChiSquareFunction function = new ChiSquareFunction(k);
     return Integrator.GaussLegendre(function, 0, x2, 1.0e-6);
 }
예제 #2
0
        /// <summary>
        /// This function return the probability density function (PDF)
        /// for ChiSquare Distribution for X2=x2 and
        /// number degree of freedom k.
        /// </summary>
        /// <param name="x2">double. x2</param>
        /// <param name="k">int. k is number degree of freedom</param>
        /// <returns>
        /// The value of probability distribution function (PDF)
        /// for ChiSquare Distribution for X2=x2 and
        /// number degree of freedom k.
        /// </returns>
        private static double PDF(double x2, int k)
        {
            // the number degree of freedom must be
            // more or equal than 1. The value of x must be
            // not less than 0
            if (k < 1 || x2 < 0)
            {
                return(double.NaN);
            }
            ChiSquareFunction function = new ChiSquareFunction(k);

            return(function.Value(x2));
        }
예제 #3
0
        /// <summary>
        /// This function return the cummulative distribution function (CDF)
        /// for ChiSquare Distribution where X2 from 0 t x2 and
        /// number degree of freedom k.
        /// </summary>
        /// <param name="x2">double. x2</param>
        /// <param name="k">int. k is number degree of freedom</param>
        /// <returns>
        /// The value of cummulative distribution function (CDF)
        /// for ChiSquare Distribution where X2 form 0 t x2 and
        /// number degree of freedom k.
        /// </returns>
        public static double CDF(double x2, int k)
        {
            // the number degree of freedom must be
            // more or equal than 1. The value of x must be
            // not less than 0
            if (k < 1 || x2 < 0)
            {
                return(double.NaN);
            }
            ChiSquareFunction function = new ChiSquareFunction(k);

            return(Integrator.GaussLegendre(function, 0, x2, 1.0e-6));
        }
예제 #4
0
 /// <summary>
 /// This function return the probability density function (PDF)
 /// for ChiSquare Distribution for X2=x2 and
 /// number degree of freedom k.
 /// </summary>
 /// <param name="x2">double. x2</param>
 /// <param name="k">int. k is number degree of freedom</param>
 /// <returns>
 /// The value of probability distribution function (PDF)
 /// for ChiSquare Distribution for X2=x2 and
 /// number degree of freedom k.
 /// </returns>
 private static double PDF(double x2, int k)
 {
     // the number degree of freedom must be
     // more or equal than 1. The value of x must be
     // not less than 0
     if (k < 1 || x2 < 0) return double.NaN;
     ChiSquareFunction function = new ChiSquareFunction(k);
     return function.Value(x2);
 }