Skip to content

Commit

Permalink
adding Gumbel functions: ccdf, logccdf, cquantile, invlogcdf invlogcc…
Browse files Browse the repository at this point in the history
…df, mgf, cgf, cf
  • Loading branch information
ajshephard committed May 21, 2024
1 parent 3f8b50e commit 6caf5ee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/univariate/continuous/gumbel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,17 @@ function logpdf(d::Gumbel, x::Real)
end

cdf(d::Gumbel, x::Real) = exp(-exp(-zval(d, x)))
ccdf(d::Gumbel, x::Real) = -expm1(-exp(-zval(d, x)))
logcdf(d::Gumbel, x::Real) = -exp(-zval(d, x))
logccdf(d::Gumbel, x::Real) = log1mexp(-exp(-zval(d, x)))

quantile(d::Gumbel, p::Real) = xval(d, -log(-log(p)))
cquantile(d::Gumbel, p::Real) = xval(d, -log(-log1p(-p)))
invlogcdf(d::Gumbel, lp::Real) = xval(d, -log(-lp))
invlogccdf(d::Gumbel, lp::Real) = xval(d, -log(-log1mexp(lp)))

gradlogpdf(d::Gumbel, x::Real) = expm1(-zval(d, x)) / d.θ

mgf(d::Gumbel, t::Real) = gamma(1.0 - d.θ * t) * exp(d.μ * t)
cgf(d::Gumbel, t::Real) = loggamma(1.0 - d.θ * t) + d.μ * t
cf(d::Gumbel, t::Real) = gamma(1.0 - im * d.θ * t) * exp(im * d.μ * t)

0 comments on commit 6caf5ee

Please sign in to comment.