I was wondering if there were statistics functions built into math libraries that are part of the standard C++ libraries like cmath. If not, can you guys recommend a good st
From https://en.cppreference.com/w/cpp/numeric/math/erfc
Normal CDF can be calculated as below:
#include#include #include using namespace std; double normalCDF(double x) // Phi(-∞, x) aka N(x) { return erfc(-x / sqrt(2))/2; }
Using 2.0 instead of 2 in the denominator helps in getting decimals instead of integers.
Hope that helps.