Skip to content

Commit f0608b4

Browse files
authored
Merge pull request #1821 from rubenseyer/gumbel-gradlogpdf
Fix typo in Gumbel `gradlogpdf`
2 parents de9d5cf + 8f68d06 commit f0608b4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/univariate/continuous/gumbel.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ logcdf(d::Gumbel, x::Real) = -exp(-zval(d, x))
102102

103103
quantile(d::Gumbel, p::Real) = d.μ - d.θ * log(-log(p))
104104

105-
gradlogpdf(d::Gumbel, x::Real) = - (1 + exp((d.μ - x) / d.θ)) / d.θ
105+
gradlogpdf(d::Gumbel, x::Real) = expm1(-zval(d, x)) / d.θ

test/gradlogpdf.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using Test
99
@test isapprox(gradlogpdf(Chisq(7.0), 12.0) , -0.29166666666666663, atol=1.0e-8)
1010
@test isapprox(gradlogpdf(Exponential(2.0), 7.0) , -0.5 , atol=1.0e-8)
1111
@test isapprox(gradlogpdf(Gamma(9.0, 0.5), 11.0) , -1.2727272727272727 , atol=1.0e-8)
12-
@test isapprox(gradlogpdf(Gumbel(3.5, 1.0), 4.0) , -1.6065306597126334 , atol=1.0e-8)
12+
@test isapprox(gradlogpdf(Gumbel(3.5, 1.0), 4.0) , -0.3934693402873666 , atol=1.0e-8)
1313
@test isapprox(gradlogpdf(Laplace(7.0), 34.0) , -1.0 , atol=1.0e-8)
1414
@test isapprox(gradlogpdf(Logistic(-6.0), 1.0) , -0.9981778976111987 , atol=1.0e-8)
1515
@test isapprox(gradlogpdf(LogNormal(5.5), 2.0) , 1.9034264097200273 , atol=1.0e-8)

0 commit comments

Comments
 (0)