Ejemplo n.º 1
0
        /// <summary>
        /// compute the "a" factor of the linear function of design2
        /// </summary>
        /// <param name="design1"></param>
        /// <param name="design2"></param>
        /// <returns></returns>
        public static double a(NuGenStatistics design1, NuGenStatistics design2)
        {
            try
            {
                return(cov(design1, design2) / (Math.Pow(design2.s(), 2)));
            }

            catch (Exception)
            {
                return(double.NaN);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// compute the "a" factor of the linear function of design
        /// </summary>
        /// <param name="design"></param>
        /// <returns></returns>
        public double a(NuGenStatistics design)
        {
            try
            {
                return(this.cov(design) / (Math.Pow(design.s(), 2)));
            }

            catch (Exception)
            {
                return(double.NaN);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// compute the correlation coefficient
        /// </summary>
        /// <param name="design1"></param>
        /// <param name="design2"></param>
        /// <returns></returns>
        public static double r(NuGenStatistics design1, NuGenStatistics design2)
        {
            try
            {
                return(cov(design1, design2) / (design1.s() * design2.s()));
            }

            catch (Exception)
            {
                return(double.NaN);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// compute the correlation coefficient
        /// </summary>
        /// <param name="design"></param>
        /// <returns></returns>
        public double r(NuGenStatistics design)
        {
            try
            {
                return(this.cov(design) / (this.s() * design.s()));
            }

            catch (Exception)
            {
                return(double.NaN);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// compute the covariance
        /// </summary>
        /// <param name="s1"></param>
        /// <param name="s2"></param>
        /// <returns></returns>
        public static double cov(NuGenStatistics s1, NuGenStatistics s2)
        {
            try
            {
                if (s1.length() != s2.length())
                {
                    return(double.NaN);
                }
                int len = s1.length();

                double sum_mul = 0;

                for (int i = 0; i <= len - 1; i++)
                {
                    sum_mul += (s1.list[i] * s2.list[i]);
                }
                return((sum_mul - len * s1.mean() * s2.mean()) / (len - 1));
            }

            catch (Exception)
            {
                return(double.NaN);
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// compute the "b" factor of the linear function of design2
 /// </summary>
 /// <param name="design1"></param>
 /// <param name="design2"></param>
 /// <returns></returns>
 public static double b(NuGenStatistics design1, NuGenStatistics design2)
 {
     return(design1.mean() - a(design1, design2) * design2.mean());
 }
Ejemplo n.º 7
0
 /// <summary>
 /// compute the "b" factor of the linear function of design
 /// </summary>
 /// <param name="design"></param>
 /// <returns></returns>
 public double b(NuGenStatistics design)
 {
     return(this.mean() - this.a(design) * design.mean());
 }