예제 #1
0
        /// <summary>
        ///   Converts a given test statistic to a p-value.
        /// </summary>
        ///
        /// <param name="x">The value of the test statistic.</param>
        ///
        /// <returns>The p-value for the given statistic.</returns>
        ///
        public override double StatisticToPValue(double x)
        {
            double p;

            switch (Tail)
            {
            case DistributionTail.TwoTail:
                p = 2.0 * StatisticDistribution.DistributionFunction((int)x);
                break;

            case DistributionTail.OneUpper:
                p = StatisticDistribution.ComplementaryDistributionFunction((int)x, inclusive: true);
                break;

            case DistributionTail.OneLower:
                p = StatisticDistribution.DistributionFunction((int)x);
                break;

            default:
                throw new InvalidOperationException();
            }
            return(p);
        }
예제 #2
0
 /// <summary>
 ///   Converts a given test statistic to a p-value.
 /// </summary>
 ///
 /// <param name="x">The value of the test statistic.</param>
 ///
 /// <returns>The p-value for the given statistic.</returns>
 ///
 public override double StatisticToPValue(double x)
 {
     return(StatisticDistribution.ComplementaryDistributionFunction(x));
 }