Exemplo n.º 1
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();
 }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
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();
 }
Exemplo n.º 4
0
        /// <summary>
        /// compute the covariance
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public double cov(NuGenStatistics s)
        {
            try
            {

                if (this.length() != s.length()) return double.NaN;
                int len = this.length();

                double sum_mul = 0;

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

            catch (Exception)
            {
                return double.NaN;
            }
        }