Composition method
In this technique , the p.d.f. of the distribution to be simulated, is expressed as a probability mixture of properly selected density functions. Let be of one-parameter density functions, where y where y is the parameter identifying a unique g(x). unique g(x). If a value of y is drawn from a continuous cumulative function for X for X will will be
and X and X is sampled from the g(x) the g(x) for that chosen y, y, the density function
If f(x) is a probability mass function
where
and are density functions (i = 1, … n), then this technique may be applied for generating a complex distribution from simpler distributions that are themselves easily generated by the inverse transform method or by the acceptance -rejection method. Suppose that we had an efficient method to simulate the value of a random variable having either of the two p.d.f.'s { p j , j>=0} j>=0} or {q {q j , j>=0}, j>=0}, and suppose we wanted to simulate the value of a random variable X having p.d.f. P(X = j) = ap j + (1 - a)q j
j >= 0,
where 0 < a < 1. One way to simulate such a r.v. X is X is to that if X 1 and X 2 are r.v.'s having respective p.d.f. { p j } and { q j }, the r.v. X defined by
note then
will have its mass function. From this it follows that we can generate the value of such a r.v. by first generating a random number U and then generate a value of X 1 if U < a and of X 2 if U > a. Example 1: Suppose we want to generate the value of an r.v. X such that
By noting that
, where
and we can accomplish this by first generating a random number U and then generating from the discrete uniform over 1, 2, . . . , 10 if U < < 0.5 and from the discrete uniform over 6, 7, 8, 9, 10 otherwise. That is, we can simulate X as follows 1) generate a random number U 1 , 2) generate a random number U 2 ,
3) if U 1 < 0.5, set X = j, if or equivalently set X = [10U 2 ] + 1.
, or equivalently if
,
4) if U1 > 0.5, set
or equivalently thus X = [5U 2 ] + 6.
,
If F i , i =1, =1, . . . , n are distribution functions and ai , i =1, . . . , n are nonnegative numbers numbers summing to 1, then the distribution function F given by
is said to be a composition of the distribution function F i , i =1, . . . , n . One way to simulate from F is is first to simulate a r.v. I, r.v. I, equal equal to i with probability ai , i =1, . . . , n , and then to simulate from the distribution F I . This approach is often referred to as the composition approach . Example 2: Generate an r.v. from
which can be written
where
Algorithm: 1) generate U 1 , U 2 from U(0,1).
2)
by inverse transform method
Example 3: Generate an r.v. from
Let
and
Thus The first random variable Y in Y in now drawn from distribution determines a particular simply generated from Algorithm: 1) generate
from U(0, 1),
. Once this y is selected, it
The desired random variable X from
is then
2) by inverse transform method 3) if Y is selected then the distribution of X is is exponential with parameter Y . Generate X by inverse transform method X = -(1/Y) log U 2.