Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
On a generalisation of the
ratio-of-uniform algorithm
Christian P. Robert
Universit´e Paris-Dauphine, CEREMADE, and CREST, Paris
1. CORE
One specific approach to random number generation (Devroye, 1986) that pro-
ceeds from the fundamental lemma of simulation Robert and Casella (2004) is the
ratio-of-uniform method (Kinderman et al., 1977). It is commonly used for the
most standard distributions as it can be calibrated to produce high acceptance
probability with a minimal number of operations. The said method is based on
the result that the uniform distribution on the set
A = (u; v) ∈ R+
× X; 0 ≤ u2
≤ f(v/u)
induces a marginal distribution with density proportional to f for the random
variable V = U. This lemma explains for the name of the method, despite neither
U nor V being marginally uniform variates. The proof of this result is a straight-
forward application of the transform method, since, if (U, V ) ∼ U(A), then the
density of (W, X) = (U2, V/U) is
˜f(w, x) ∝ IA(w
1/2
, w
1/2
x) × w
1/2
×
1
2w1/2
∝ I0≤w≤f(x)
As mentioned already, this is therefore a consequence of the fundamental lemma
of simulation, since we recover the uniform distribution on the set
B = (u; v) ∈ R+
× X; 0 ≤ u ≤ f(v)
which clearly induces the marginal distribution with density proportional to f
on V . While there is thus no mathematical issue with the marginalisation result
behind the ratio-of-uniform method, it is much less straightforward to picture the
construction of efficient random number generators based on this principle, when
compared with the fundamental lemma.
The first difficulty is to determine the shape of the set A, for which there is
little intuition if any. Figure 1 displays the resulting sets A for the Normal N(0, 1)
and the Gamma Ga(1/2, 1) distributions. The later is unbounded in u, due to the
asymptote of the density f at x = 0. In the general case, the boundary of the set
A is given by the parametric curve (Devroye, 1986)
u(x) = f(x), v(x) = x f(x), x ∈ X .
∗
Christian P. Robert, CEREMADE, Universit´e Paris-Dauphine, 75775 Paris cedex 16, France
xian@ceremade.dauphine.fr. Research partly supported by a Institut Universitaire de France 2016–
2021 senior chair. C.P. Robert is also affiliated as a part-time professor in the Department of
Statistics of the University of Warwick, Coventry, UK.
1
imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
2
Fig 1. Representation of the ratio-of-uniform set A for the Normal N(0, 1) and the Gamma
Ga(1/2, 1) distributions.
In the event where X ⊂ R and both f(x) and x2f(x) are bounded over X, it
is formally possible to create a cube in R+ × X around A and to deduce an
accept-reject strategy, based on uniform simulations in that cube. Using a two
component normal mixture as a benchmark, the following pictures (Figures 2
and 3) show that the set A is then bounded, albeit quite sparse in the cube that
contains it. This implies that the ratio-of-uniform method would not be efficient
in that situation.
As pointed out in Devroye (1986), since a simulation from f can also be derived
by uniform simulations on sets like
C = (u; v) ∈ R+
× X; 0 ≤ u ≤ f(u + v)
with a marginalisation in U + V , or
D = (u; v) ∈ R+
× X; 0 ≤ u2
≤ f(v/
√
u)3
with a marginalisation in V/
√
U. As we will now demonstrate, there exists a
generic construction of such sets. However, it seems impossible to rank those sets
in terms of efficiency in the general case. (This comparison only stands under the
assumption that all relevant functions are properly bounded to allow for bound-
ing boxes.) Even without seeking a bounding box and the associated uniform
distribution on that set, it seems delicate to compare slice samplers on the three
sets A, C, D, and their generalisations.
2. EXTENSION
There exists a generic family of transforms that generalises the original ratio-
of- uniform method. Namely, considering a differentiable monotone function h
over the positive half-line, R+, the uniform distribution over the set
H = (u; v) ∈ R+
× X; 0 ≤ u ≤ h ◦ f(v/g(u))
induces the right marginal f on the ratio V/g(U) if the primitive G of g is the
inverse of h, i.e., G ◦ h(x) = x. The proof is rather straightforward. Considering
imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
3
Fig 2. Set A for a two component Normal mixture.
Fig 3. Set A for a four component Normal mixture.
imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
4
the change of variable from (u, v) to (u, x) = (u, v/g(u)) produces a Jacobian of
g(u) and a joint density
U, X ∼ I0≤u≤h◦f(x)(u, x) g(u)
which integrates into
X ∼
h◦f(x)
0
g(u) du = G ◦ h ◦ f(x) = f(x)
when G ◦ f = id. The corresponding boundary of H is then provided by the
parameterised curve
u(x) = h ◦ f(x), v(x) = x(g ◦ h ◦ f)(x), x ∈ X .
For instance, when h(x) = xa, a power transform, the boundary can be written
as
u(x) = f(x)a
, v(x) = xf(x)1−a
, x ∈ X .
Similarly, when h(x) = exp(x), the ratio-of-uniform set is defined as
H = (u; v) ∈ R+
× X; 1 ≤ u ≤ exp{f(vu)}
with the curve
u(x) = exp{f(x)}, v(x) = x exp{−f(x)}, x ∈ X .
Note the change of range for u in that case.
One appeal of this generalisation is the formal possibility to include unbounded
densities and still produce compact boxes, as this seems essential for accept-reject
simulation if not for slice sampling. One possible choice for h is the generalised
logistic transform
h(ω) =
ωa
1 + ωa
which ensures that the [ratio-of-almost-uniform] set H is bounded in u. Since the
transform g is the derivative of the inverse of h,
g(y) =
a−1y(1−a)/a
(1 − y)(1+a)/a
.
the parametrisation of the boundary of H is
u(x) =
f(x)a
(1 + f(x))a
, v(x) = a−1
xf(x)a−1
(1 + f(x))−2
[(1 + f(x)a
− f(x)a
]−1+a/a
which means H remains bounded if (a) a ≤ 1 [to ensure boundedness at infinity]
and (b) the limit of v(x) at zero [where the asymptote of f must stand] is bounded.
This is satisfied if
lim
x→0
xf(x)
a+1/a
< +∞ .
For instance, this constraint holds for Gamma distributions with shape parameter
larger than 1/2.
imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
5
However, resorting to an arbitrary cdf Φ instead of the generalised logistic cdf
solves the difficulty for most distributions, including all Gamma distributions.
(Note that the power a is superfluous since Φa is also a cdf. Nonetheless, using this
representation brings an easier calibration of the proposal.) Indeed, the relevant
set is now
H = (u; v) ∈ R+
× X; 0 ≤ u ≤ Φ(f(v/g(u)))a
while the boundary of H is
u(x) = Φ(f(x))a
, v(x) = a−1
xf(x)
1−a/a
/ϕ ◦ f(x), x ∈ X ,
when ϕ is the derivative of Φ. This can be seen from G(u) = Φ−1(u1/a
) and
g(u) = a−1
u
1−a/a
ϕ(Φ−1
(u
1/a
))
which implies that
g(u(x)) = a−1
f(x)
1−a/a
ϕ(Φ−1
(Φ(f(x)))) .
This result means that the set remains bounded if ϕ has heavy enough tails, like
x−2, to handle the explosion at x = 0. Obviously, the density ϕ must further
enjoy an asymptote at zero to handle the limit at infinity when f(x) goes to zero.
For instance, consider the case when a = 1, meaning the boundary of H is
u(x) = Φ(f(x)), v(x) = 1/ϕ ◦ f(x),
and assume f(x) ≡ x− at x = 0 and ϕ(y) ≡ y−α−1 at y = +∞. At x = 0 we then
have v(x) ≡ x1− (α+1), which is a positive power for α small enough. Furthermore,
if f(x) ≡ x−δ−1 at x = ∞ and ϕ(y) ≡ y−β at y = 0, then at x = +∞, we have
v(x) ≡ x1−β(δ+1), which is a negative power for β close enough to 1.
However, this type of tail behaviour in Φ is not sufficient to handle a Gamma
distribution Ga(1 − , 1) (0 < < 1) since the exponential term is dominant at
∞. Take thus a transform such that φ(x) is equivalent to log{1/x}b (b > 0) near
zero. Then, at ∞
x/ϕ◦f(x) ≡ x {(−(1 − ) log(x) + x}−b
≡ x1−b
which remains bounded when b > 1, as for instance b = 2. The behaviour of
x/ϕ◦f(x) is easier to manage since f is then equivalent to x1− . If the tail behaviour
of ϕ at infinity is polynomial, i.e., ϕ(y) ≡ y−1−ν, we get
x/ϕ◦f(x) ≡ x x−1+ −(1+ν)
≡ x1−(1− )(1+ν)
at infinity, which remains bounded when (1 − )(1 + ν) < 1, i.e., ν < /1− . For
practical purposes, we consider the mixture density 0 < γ < 1)
ϕ(x) = γ
2 log(x)2
1 + (1 + log(2))2
I(0,1/2)(x) + (1 − γ)
ν{3/2}ν
(1 + x)ν+1
I(0,1/2)c (x)
which is normalised, continuous at x = 1/2 when
γ =
1
1 + 3ν log(2)2
/1+(1+log(2))2
imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
6
Fig 4. Set H for (a) Ga(0.1, 1) target; (b) Ga(0.5, 1) target; (c) Ga(0.9, 1) target, when ν =
.9 /(1 − ).
imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
7
and associated with the cdf
Φ(x) = γ
2x[(1 − log(x))2 + 1]
1 + (1 + log(2))2
I(0,1/2)(x)+ γ + (1 − γ) 1 −
(3/2)ν
(1 + x)ν
I(0,1/2)c (x)
Figure 4 produces three different bounded sets for Ga(α, 1) distributions based
on the above mixture transform Φ. Obviously, given the shape of those sets,
using a rectangular box does not lead to an efficient simulation algorithm. (This
goes without mentioning that a Ga(1 − , 1) distribution can be derived from a
Ga(2 − , 1) by multiplying a simulation from the former by U−1/1−
.)
REFERENCES
Devroye, L. (1986). Non-Uniform Random Variate Generation. Springer-Verlag, New York.
URL http://cgm.cs.mcgill.ca/~luc/rnbookindex.html.
Kinderman, A., Monahan, J. and Ramage, J. (1977). Computer methods for sampling from
Student’s t-distribution. Math. Comput., 31 1009–1018.
Robert, C. and Casella, G. (2004). Monte Carlo Statistical Methods. 2nd ed. Springer-Verlag,
New York.
imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016

More Related Content

A generalisation of the ratio-of-uniform algorithm

  • 1. On a generalisation of the ratio-of-uniform algorithm Christian P. Robert Universit´e Paris-Dauphine, CEREMADE, and CREST, Paris 1. CORE One specific approach to random number generation (Devroye, 1986) that pro- ceeds from the fundamental lemma of simulation Robert and Casella (2004) is the ratio-of-uniform method (Kinderman et al., 1977). It is commonly used for the most standard distributions as it can be calibrated to produce high acceptance probability with a minimal number of operations. The said method is based on the result that the uniform distribution on the set A = (u; v) ∈ R+ × X; 0 ≤ u2 ≤ f(v/u) induces a marginal distribution with density proportional to f for the random variable V = U. This lemma explains for the name of the method, despite neither U nor V being marginally uniform variates. The proof of this result is a straight- forward application of the transform method, since, if (U, V ) ∼ U(A), then the density of (W, X) = (U2, V/U) is ˜f(w, x) ∝ IA(w 1/2 , w 1/2 x) × w 1/2 × 1 2w1/2 ∝ I0≤w≤f(x) As mentioned already, this is therefore a consequence of the fundamental lemma of simulation, since we recover the uniform distribution on the set B = (u; v) ∈ R+ × X; 0 ≤ u ≤ f(v) which clearly induces the marginal distribution with density proportional to f on V . While there is thus no mathematical issue with the marginalisation result behind the ratio-of-uniform method, it is much less straightforward to picture the construction of efficient random number generators based on this principle, when compared with the fundamental lemma. The first difficulty is to determine the shape of the set A, for which there is little intuition if any. Figure 1 displays the resulting sets A for the Normal N(0, 1) and the Gamma Ga(1/2, 1) distributions. The later is unbounded in u, due to the asymptote of the density f at x = 0. In the general case, the boundary of the set A is given by the parametric curve (Devroye, 1986) u(x) = f(x), v(x) = x f(x), x ∈ X . ∗ Christian P. Robert, CEREMADE, Universit´e Paris-Dauphine, 75775 Paris cedex 16, France xian@ceremade.dauphine.fr. Research partly supported by a Institut Universitaire de France 2016– 2021 senior chair. C.P. Robert is also affiliated as a part-time professor in the Department of Statistics of the University of Warwick, Coventry, UK. 1 imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
  • 2. 2 Fig 1. Representation of the ratio-of-uniform set A for the Normal N(0, 1) and the Gamma Ga(1/2, 1) distributions. In the event where X ⊂ R and both f(x) and x2f(x) are bounded over X, it is formally possible to create a cube in R+ × X around A and to deduce an accept-reject strategy, based on uniform simulations in that cube. Using a two component normal mixture as a benchmark, the following pictures (Figures 2 and 3) show that the set A is then bounded, albeit quite sparse in the cube that contains it. This implies that the ratio-of-uniform method would not be efficient in that situation. As pointed out in Devroye (1986), since a simulation from f can also be derived by uniform simulations on sets like C = (u; v) ∈ R+ × X; 0 ≤ u ≤ f(u + v) with a marginalisation in U + V , or D = (u; v) ∈ R+ × X; 0 ≤ u2 ≤ f(v/ √ u)3 with a marginalisation in V/ √ U. As we will now demonstrate, there exists a generic construction of such sets. However, it seems impossible to rank those sets in terms of efficiency in the general case. (This comparison only stands under the assumption that all relevant functions are properly bounded to allow for bound- ing boxes.) Even without seeking a bounding box and the associated uniform distribution on that set, it seems delicate to compare slice samplers on the three sets A, C, D, and their generalisations. 2. EXTENSION There exists a generic family of transforms that generalises the original ratio- of- uniform method. Namely, considering a differentiable monotone function h over the positive half-line, R+, the uniform distribution over the set H = (u; v) ∈ R+ × X; 0 ≤ u ≤ h ◦ f(v/g(u)) induces the right marginal f on the ratio V/g(U) if the primitive G of g is the inverse of h, i.e., G ◦ h(x) = x. The proof is rather straightforward. Considering imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
  • 3. 3 Fig 2. Set A for a two component Normal mixture. Fig 3. Set A for a four component Normal mixture. imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
  • 4. 4 the change of variable from (u, v) to (u, x) = (u, v/g(u)) produces a Jacobian of g(u) and a joint density U, X ∼ I0≤u≤h◦f(x)(u, x) g(u) which integrates into X ∼ h◦f(x) 0 g(u) du = G ◦ h ◦ f(x) = f(x) when G ◦ f = id. The corresponding boundary of H is then provided by the parameterised curve u(x) = h ◦ f(x), v(x) = x(g ◦ h ◦ f)(x), x ∈ X . For instance, when h(x) = xa, a power transform, the boundary can be written as u(x) = f(x)a , v(x) = xf(x)1−a , x ∈ X . Similarly, when h(x) = exp(x), the ratio-of-uniform set is defined as H = (u; v) ∈ R+ × X; 1 ≤ u ≤ exp{f(vu)} with the curve u(x) = exp{f(x)}, v(x) = x exp{−f(x)}, x ∈ X . Note the change of range for u in that case. One appeal of this generalisation is the formal possibility to include unbounded densities and still produce compact boxes, as this seems essential for accept-reject simulation if not for slice sampling. One possible choice for h is the generalised logistic transform h(ω) = ωa 1 + ωa which ensures that the [ratio-of-almost-uniform] set H is bounded in u. Since the transform g is the derivative of the inverse of h, g(y) = a−1y(1−a)/a (1 − y)(1+a)/a . the parametrisation of the boundary of H is u(x) = f(x)a (1 + f(x))a , v(x) = a−1 xf(x)a−1 (1 + f(x))−2 [(1 + f(x)a − f(x)a ]−1+a/a which means H remains bounded if (a) a ≤ 1 [to ensure boundedness at infinity] and (b) the limit of v(x) at zero [where the asymptote of f must stand] is bounded. This is satisfied if lim x→0 xf(x) a+1/a < +∞ . For instance, this constraint holds for Gamma distributions with shape parameter larger than 1/2. imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
  • 5. 5 However, resorting to an arbitrary cdf Φ instead of the generalised logistic cdf solves the difficulty for most distributions, including all Gamma distributions. (Note that the power a is superfluous since Φa is also a cdf. Nonetheless, using this representation brings an easier calibration of the proposal.) Indeed, the relevant set is now H = (u; v) ∈ R+ × X; 0 ≤ u ≤ Φ(f(v/g(u)))a while the boundary of H is u(x) = Φ(f(x))a , v(x) = a−1 xf(x) 1−a/a /ϕ ◦ f(x), x ∈ X , when ϕ is the derivative of Φ. This can be seen from G(u) = Φ−1(u1/a ) and g(u) = a−1 u 1−a/a ϕ(Φ−1 (u 1/a )) which implies that g(u(x)) = a−1 f(x) 1−a/a ϕ(Φ−1 (Φ(f(x)))) . This result means that the set remains bounded if ϕ has heavy enough tails, like x−2, to handle the explosion at x = 0. Obviously, the density ϕ must further enjoy an asymptote at zero to handle the limit at infinity when f(x) goes to zero. For instance, consider the case when a = 1, meaning the boundary of H is u(x) = Φ(f(x)), v(x) = 1/ϕ ◦ f(x), and assume f(x) ≡ x− at x = 0 and ϕ(y) ≡ y−α−1 at y = +∞. At x = 0 we then have v(x) ≡ x1− (α+1), which is a positive power for α small enough. Furthermore, if f(x) ≡ x−δ−1 at x = ∞ and ϕ(y) ≡ y−β at y = 0, then at x = +∞, we have v(x) ≡ x1−β(δ+1), which is a negative power for β close enough to 1. However, this type of tail behaviour in Φ is not sufficient to handle a Gamma distribution Ga(1 − , 1) (0 < < 1) since the exponential term is dominant at ∞. Take thus a transform such that φ(x) is equivalent to log{1/x}b (b > 0) near zero. Then, at ∞ x/ϕ◦f(x) ≡ x {(−(1 − ) log(x) + x}−b ≡ x1−b which remains bounded when b > 1, as for instance b = 2. The behaviour of x/ϕ◦f(x) is easier to manage since f is then equivalent to x1− . If the tail behaviour of ϕ at infinity is polynomial, i.e., ϕ(y) ≡ y−1−ν, we get x/ϕ◦f(x) ≡ x x−1+ −(1+ν) ≡ x1−(1− )(1+ν) at infinity, which remains bounded when (1 − )(1 + ν) < 1, i.e., ν < /1− . For practical purposes, we consider the mixture density 0 < γ < 1) ϕ(x) = γ 2 log(x)2 1 + (1 + log(2))2 I(0,1/2)(x) + (1 − γ) ν{3/2}ν (1 + x)ν+1 I(0,1/2)c (x) which is normalised, continuous at x = 1/2 when γ = 1 1 + 3ν log(2)2 /1+(1+log(2))2 imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
  • 6. 6 Fig 4. Set H for (a) Ga(0.1, 1) target; (b) Ga(0.5, 1) target; (c) Ga(0.9, 1) target, when ν = .9 /(1 − ). imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016
  • 7. 7 and associated with the cdf Φ(x) = γ 2x[(1 − log(x))2 + 1] 1 + (1 + log(2))2 I(0,1/2)(x)+ γ + (1 − γ) 1 − (3/2)ν (1 + x)ν I(0,1/2)c (x) Figure 4 produces three different bounded sets for Ga(α, 1) distributions based on the above mixture transform Φ. Obviously, given the shape of those sets, using a rectangular box does not lead to an efficient simulation algorithm. (This goes without mentioning that a Ga(1 − , 1) distribution can be derived from a Ga(2 − , 1) by multiplying a simulation from the former by U−1/1− .) REFERENCES Devroye, L. (1986). Non-Uniform Random Variate Generation. Springer-Verlag, New York. URL http://cgm.cs.mcgill.ca/~luc/rnbookindex.html. Kinderman, A., Monahan, J. and Ramage, J. (1977). Computer methods for sampling from Student’s t-distribution. Math. Comput., 31 1009–1018. Robert, C. and Casella, G. (2004). Monte Carlo Statistical Methods. 2nd ed. Springer-Verlag, New York. imsart-sts ver. 2009/02/27 file: ratiU.tex date: November 18, 2016