You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed a problem with the cdf of InverseGaussian distribution which can potentially be equal to Inf. This is a problem since a cdf is probability and consequently must be between 0 and 1. For example,
d = InverseGaussian(1.65,590)
cdf(d, 2.)
returns Inf. In addition, if you plot the empirical histogram, you can see that 2.0 is not so extreme with respect to the simulated values.
histogram(rand(d, 10000),normalize=:pdf)
For comparison, in the same situation R provides the good value of the cdf which is equal to 1 in this case.
Best regards.
Laurent
The text was updated successfully, but these errors were encountered:
Hello,
I found the solution thanks to a colleague: using the logdcf function.
d = InverseGaussian(1.65,590)
exp(logcdf(d, 2.))
gives the correct answer, that is to say 1 in this case
For most distributions, logcdf function simply takes the logarithm of cdf. But for some distributions that may have numerical problems for certain parameter values (such as the inverse Gaussian distribution), the logcdf function implements the calculation in a more subtle way and avoids numerical problems by scaling to log.
Best ragards
Laurent
Hi,
I have noticed a problem with the cdf of InverseGaussian distribution which can potentially be equal to Inf. This is a problem since a cdf is probability and consequently must be between 0 and 1. For example,
d = InverseGaussian(1.65,590)
cdf(d, 2.)
returns Inf. In addition, if you plot the empirical histogram, you can see that 2.0 is not so extreme with respect to the simulated values.
histogram(rand(d, 10000),normalize=:pdf)
For comparison, in the same situation R provides the good value of the cdf which is equal to 1 in this case.
Best regards.
Laurent
The text was updated successfully, but these errors were encountered: