Open andreasmueller opened 11 years ago
Distribution::Normal.cdf(-36) => 0.0 Distribution::Normal.cdf(-37) => 0.0 Distribution::Normal.cdf(-38) => 0.0 Distribution::Normal.cdf(-39) => 0.5 Distribution::Normal.cdf(38) => 1.0 Distribution::Normal.cdf(39) => 0.5
Since I just discovered that the Ruby Math library has an erf function, I switched to just using
0.5*(1.0+Math.erf(x.to_f/Math.sqrt(2.0)))
Maybe fixing this bug could help others, though.
I also noticed this issue for the chi-square distribution.
Distribution::ChiSquare.q_chi2(3, 2000) => 1.0
Since I just discovered that the Ruby Math library has an erf function, I switched to just using
0.5*(1.0+Math.erf(x.to_f/Math.sqrt(2.0)))
Maybe fixing this bug could help others, though.