@@ -16,9 +16,6 @@ Base.maximum(::Flat) = Inf
16
16
Base. rand (rng:: Random.AbstractRNG , d:: Flat ) = rand (rng)
17
17
Distributions. logpdf (:: Flat , x:: Real ) = zero (x)
18
18
19
- # TODO : only implement `logpdf(d, ::Real)` if support for Distributions < 0.24 is dropped
20
- Distributions. pdf (d:: Flat , x:: Real ) = exp (logpdf (d, x))
21
-
22
19
# For vec support
23
20
Distributions. logpdf (:: Flat , x:: AbstractVector{<:Real} ) = zero (x)
24
21
Distributions. loglikelihood (:: Flat , x:: AbstractVector{<:Real} ) = zero (eltype (x))
@@ -41,17 +38,13 @@ struct FlatPos{T<:Real} <: ContinuousUnivariateDistribution
41
38
end
42
39
43
40
Base. minimum (d:: FlatPos ) = d. l
44
- Base. maximum (d :: FlatPos ) = Inf
41
+ Base. maximum (:: FlatPos ) = Inf
45
42
46
43
Base. rand (rng:: Random.AbstractRNG , d:: FlatPos ) = rand (rng) + d. l
47
44
function Distributions. logpdf (d:: FlatPos , x:: Real )
48
45
z = float (zero (x))
49
46
return x <= d. l ? oftype (z, - Inf ) : z
50
47
end
51
-
52
- # TODO : only implement `logpdf(d, ::Real)` if support for Distributions < 0.24 is dropped
53
- Distributions. pdf (d:: FlatPos , x:: Real ) = exp (logpdf (d, x))
54
-
55
48
# For vec support
56
49
function Distributions. loglikelihood (d:: FlatPos , x:: AbstractVector{<:Real} )
57
50
lower = d. l
@@ -91,12 +84,7 @@ BinomialLogit(n::Int, logitp::Real) = BinomialLogit{typeof(logitp)}(n, logitp)
91
84
Base. minimum (:: BinomialLogit ) = 0
92
85
Base. maximum (d:: BinomialLogit ) = d. n
93
86
94
- # TODO : only implement `logpdf(d, k::Real)` if support for Distributions < 0.24 is dropped
95
- Distributions. pdf (d:: BinomialLogit , k:: Real ) = exp (logpdf (d, k))
96
- Distributions. logpdf (d:: BinomialLogit , k:: Real ) = _logpdf (d, k)
97
- Distributions. logpdf (d:: BinomialLogit , k:: Integer ) = _logpdf (d, k)
98
-
99
- function _logpdf (d:: BinomialLogit , k:: Real )
87
+ function Distributions. logpdf (d:: BinomialLogit , k:: Real )
100
88
n, logitp, logconstant = d. n, d. logitp, d. logconstant
101
89
_insupport = insupport (d, k)
102
90
_k = _insupport ? round (Int, k) : 0
@@ -109,16 +97,6 @@ function Base.rand(rng::Random.AbstractRNG, d::BinomialLogit)
109
97
end
110
98
Distributions. sampler (d:: BinomialLogit ) = sampler (Binomial (d. n, logistic (d. logitp)))
111
99
112
- # Part of Distributions >= 0.25.77
113
- if ! isdefined (Distributions, :BernoulliLogit )
114
- """
115
- BernoulliLogit(logitp::Real)
116
-
117
- Create a univariate logit-parameterised Bernoulli distribution.
118
- """
119
- BernoulliLogit (logitp:: Real ) = BinomialLogit (1 , logitp)
120
- end
121
-
122
100
"""
123
101
OrderedLogistic(η, c::AbstractVector)
124
102
151
129
Base. minimum (d:: OrderedLogistic ) = 0
152
130
Base. maximum (d:: OrderedLogistic ) = length (d. cutpoints) + 1
153
131
154
- # TODO : only implement `logpdf(d, k::Real)` if support for Distributions < 0.24 is dropped
155
- Distributions. pdf (d:: OrderedLogistic , k:: Real ) = exp (logpdf (d, k))
156
- Distributions. logpdf (d:: OrderedLogistic , k:: Real ) = _logpdf (d, k)
157
- Distributions. logpdf (d:: OrderedLogistic , k:: Integer ) = _logpdf (d, k)
158
-
159
- function _logpdf (d:: OrderedLogistic , k:: Real )
132
+ function Distributions. logpdf (d:: OrderedLogistic , k:: Real )
160
133
η, cutpoints = d. η, d. cutpoints
161
134
K = length (cutpoints) + 1
162
135
@@ -232,18 +205,13 @@ LogPoisson(logλ::Real) = LogPoisson{typeof(logλ)}(logλ)
232
205
Base. minimum (d:: LogPoisson ) = 0
233
206
Base. maximum (d:: LogPoisson ) = Inf
234
207
235
- function _logpdf (d:: LogPoisson , k:: Real )
208
+ function Distributions . logpdf (d:: LogPoisson , k:: Real )
236
209
_insupport = insupport (d, k)
237
210
_k = _insupport ? round (Int, k) : 0
238
211
logp = _k * d. logλ - d. λ - SpecialFunctions. loggamma (_k + 1 )
239
212
240
213
return _insupport ? logp : oftype (logp, - Inf )
241
214
end
242
215
243
- # TODO : only implement `logpdf(d, ::Real)` if support for Distributions < 0.24 is dropped
244
- Distributions. pdf (d:: LogPoisson , k:: Real ) = exp (logpdf (d, k))
245
- Distributions. logpdf (d:: LogPoisson , k:: Integer ) = _logpdf (d, k)
246
- Distributions. logpdf (d:: LogPoisson , k:: Real ) = _logpdf (d, k)
247
-
248
216
Base. rand (rng:: Random.AbstractRNG , d:: LogPoisson ) = rand (rng, Poisson (d. λ))
249
217
Distributions. sampler (d:: LogPoisson ) = sampler (Poisson (d. λ))
0 commit comments