/// <summary> /// Gets the complementary cumulative distribution function /// (ccdf) for this distribution evaluated at point <c>x</c>. /// This function is also known as the Survival function. /// </summary> /// /// <remarks> /// The Complementary Cumulative Distribution Function (CCDF) is /// the complement of the Cumulative Distribution Function, or 1 /// minus the CDF. /// </remarks> /// public override double ComplementaryDistributionFunction(params double[] x) { if (Dimension == 1) { double stdDev = Math.Sqrt(Covariance[0, 0]); double z = (x[0] - mean[0]) / stdDev; if (stdDev == 0) { return((x[0] == mean[0]) ? 0 : 1); } return(Normal.Complemented(z)); } if (Dimension == 2) { double sigma1 = Math.Sqrt(Covariance[0, 0]); double sigma2 = Math.Sqrt(Covariance[1, 1]); double rho = Covariance[0, 1] / (sigma1 * sigma2); if (Double.IsNaN(rho)) { return((x.IsEqual(mean)) ? 0 : 1); } double z = (x[0] - mean[0]) / sigma1; double w = (x[1] - mean[1]) / sigma2; return(Normal.BivariateComplemented(z, w, rho)); } throw new NotSupportedException("The cumulative distribution " + "function is only available for up to two dimensions."); }