コード例 #1
0
ファイル: t.cs プロジェクト: ammepuspita/zaitun-time-series
 /// <summary>
 /// This function return the cummulative distribution function (CDF)
 /// for Student's t distribution less than t and number degree of
 /// freedom k.
 /// </summary>
 /// <param name="t">double. t</param>
 /// <param name="k">int. k is number degree of freedom</param>
 /// <returns>
 /// The value of cummulative distribution function (CDF)
 /// for Student's t distribution less than t and number degree of
 /// freedom k.
 /// </returns>
 public static double CDF(double t, int k)
 {
     // number degree of freedom must be mor than 0
     if (k <= 0) return double.NaN;
     if (t == 0) return 0.5;
     StudentFunction function = new StudentFunction(k);
     if (t < 0)
         return 0.5 - Integrator.GaussLegendre(function, t, 0, 1.0e-6);
     else
         return 0.5 + Integrator.GaussLegendre(function, 0, t, 1.0e-6);
 }
コード例 #2
0
ファイル: t.cs プロジェクト: ammepuspita/zaitun-time-series
 /// <summary>
 /// This function return the probability density function (PDF)
 /// for Student's t distribution with T=t and number degree
 /// of freedom k.
 /// </summary>
 /// <param name="t">double. t</param>
 /// <param name="k">int. k is number degree of freedom</param>
 /// <returns>
 /// The value of probability density function (PDF)
 /// for Student's t distribution with T=t and number degree
 /// of freedom k.
 /// </returns>
 private static double PDF(double t, int k)
 {
     StudentFunction function = new StudentFunction(k);
     return function.Value(t);
 }