Skip to content

Commit 926b2dc

Browse files
authored
[bugfix] Gumbel pdf value on hypercubes boundary was NaN (#245)
1 parent e6c3602 commit 926b2dc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/BivariateArchimedeanMethods.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ function _cdf(C::ArchimedeanCopula{2,G}, u) where {G<:GumbelGenerator}
66
return 1 - LogExpFunctions.cexpexp(LogExpFunctions.logaddexp* lx₁, θ * lx₂) / θ)
77
end
88
function Distributions._logpdf(C::ArchimedeanCopula{2,G}, u) where {G<:GumbelGenerator}
9-
!all(0 .<= u .<= 1) && return eltype(u)(-Inf) # if not in range return -Inf
9+
T = promote_type(Float64, eltype(u))
10+
!all(0 .< u .<= 1) && return T(-Inf) # if not in range return -Inf
1011

1112
θ = C.G.θ
1213
x₁, x₂ = -log(u[1]), -log(u[2])

test/GumbelCopula.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,12 @@
99
u = [0.969034207932297,0.9638122014293545]
1010
den = pdf(G, u)
1111
@test true
12+
end
13+
14+
@testitem "Boundary test for bivariate Gumbel" begin
15+
using Distributions
16+
G = GumbelCopula(2, 2.5)
17+
@test pdf(G, [0.1,0.0]) == 0.0
18+
@test pdf(G, [0.0,0.1]) == 0.0
19+
@test pdf(G, [0.0,0.0]) == 0.0
1220
end

0 commit comments

Comments
 (0)