JuliaStats / Distributions.jl

A Julia package for probability distributions and associated functions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion: 3-argument cdf()

droodman opened this issue · comments

In my application, I want to accurately and efficiently compute

cdf(Normal(),x2) - cdf(Normal(),x1)

for general x1 and x2.
A complication: if x1 and x2 are both large, say >=10, then each cdf() call returns 1 and the difference is 0. I get a more accurate result if I replace the above with

ccdf(Normal(),x1) - ccdf(Normal(),x2)

So in general, on each call, I need to check the values of x1 and x2 and decide which expression to use.

It seems to me that it would be good if the Distributions.jl interface were extended to this case. Then I could do

cdf(Normal(),x1,x2)

...and place my trust in a well-crafted implementation.

Oop, I see there is logdiffcdf().