-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix InverseGaussian cdf overflows (#1882)
* Fix inversegaussian cdf overflows * Update src/univariate/continuous/inversegaussian.jl Co-authored-by: David Widmann <[email protected]> * Update src/univariate/continuous/inversegaussian.jl Co-authored-by: David Widmann <[email protected]> * Fix missing parentheses * Move parentheses * Move new tests to dedicated inversegaussian file * Add ccdf tests --------- Co-authored-by: David Widmann <[email protected]>
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@testset "InverseGaussian cdf outside of [0, 1] (#1873)" begin | ||
for d in [ | ||
InverseGaussian(1.65, 590), | ||
InverseGaussian(0.5, 1000) | ||
] | ||
for x in [0.02, 1.0, 20.0, 300.0] | ||
p = cdf(d, x) | ||
@test 0.0 <= p <= 1.0 | ||
@test p ≈ exp(logcdf(d, x)) | ||
|
||
q = ccdf(d, x) | ||
@test 0.0 <= q <= 1.0 | ||
@test q ≈ exp(logccdf(d, x)) | ||
|
||
@test (p + q) ≈ 1 | ||
end | ||
end | ||
end |