Skip to content

Commit

Permalink
Fix Gumbel gradlogpdf
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenseyer authored Jan 8, 2024
1 parent de9d5cf commit 07d0ed5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/univariate/continuous/gumbel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ logcdf(d::Gumbel, x::Real) = -exp(-zval(d, x))

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

gradlogpdf(d::Gumbel, x::Real) = - (1 + exp((d.μ - x) / d.θ)) / d.θ
gradlogpdf(d::Gumbel, x::Real) = (-1 + exp(-zval(d, x))) / d.θ
2 changes: 1 addition & 1 deletion test/gradlogpdf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using Test
@test isapprox(gradlogpdf(Chisq(7.0), 12.0) , -0.29166666666666663, atol=1.0e-8)
@test isapprox(gradlogpdf(Exponential(2.0), 7.0) , -0.5 , atol=1.0e-8)
@test isapprox(gradlogpdf(Gamma(9.0, 0.5), 11.0) , -1.2727272727272727 , atol=1.0e-8)
@test isapprox(gradlogpdf(Gumbel(3.5, 1.0), 4.0) , -1.6065306597126334 , atol=1.0e-8)
@test isapprox(gradlogpdf(Gumbel(3.5, 1.0), 4.0) , -0.3934693402873666 , atol=1.0e-8)
@test isapprox(gradlogpdf(Laplace(7.0), 34.0) , -1.0 , atol=1.0e-8)
@test isapprox(gradlogpdf(Logistic(-6.0), 1.0) , -0.9981778976111987 , atol=1.0e-8)
@test isapprox(gradlogpdf(LogNormal(5.5), 2.0) , 1.9034264097200273 , atol=1.0e-8)
Expand Down

0 comments on commit 07d0ed5

Please sign in to comment.