Statistics/Chi-squared distribution: Difference between revisions

m
change function names to reflect text at top
m (cleanup)
m (change function names to reflect text at top)
Line 96:
end
 
""" gamma CDF from lower incomplete gamma function, using MPFR library to get upper incomplete gamma """
function γgamma_cdf(a, x)
z, biga, bigx = BigFloat(), BigFloat(a), BigFloat(x)
ccall((:mpfr_gamma_inc, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Ref{BigFloat}, Int32), z, biga, bigx, 0)
Line 105:
""" Cumulative probability function (cdf) for chi-squared """
function cdf_χ2(x, k)
return x <= 0 || k <= 0 ? 0.0 : γgamma_cdf(k / 2, x / 2)
end
 
4,107

edits