Freelance web design - 3.4.1 NUMERICAL DISTRIBUTIONS 121 Fig. 11. Region of

3.4.1 NUMERICAL DISTRIBUTIONS 121 Fig. 11. Region of acceptance in Algorithm L. cases f(x)/cg(x) is always 0 or 1; then U need not be generated. In other cases if f(x)/cg(Z) is hard to compute, we may be able to squeeze it between two bounding functions r(x) I f(x)/cdx) 5 4×1 (18) that are much simpler, and the exact value of f(z)/cg(z) need not be calculated unless T(Z) 5 U < s(z). The following algorithm solves the wedge problem by developing the rejection method still further. Algorithm L (Nearly linear densities). This algorithm may be used to generate a random variable X for any distribution whose density f(x) satisfies the following conditions (cf. Fig. 10): f(x) = 0, for x < s and for x > s + h; (1% a -b(x -s)/h 5 f(x) 5 b - b(x -s)/h, for s < x 5 s + h. Ll. [Get U 5 V.] Generate two independent random variables U, V, uniformly distributed between zero and one. If U > V, exchange U ++ V. L2. [Easy case?] If V 5 a/b, go to L4. L3. [Try again?] If V > U + (l/b)f(s + hU), go back to step Ll. (If a/b is close to 1, this step of the algorithm will not be necessary very often.) L4. [Compute X.1 Set X c s + hU. I When step L4 is reached, the point (U, V) is a random point in the area shaded in Fig. 11, namely, 0 5 U < V < U + (l/b)f(s + hU). Conditions (19) ensure that ; 5 U + $I(s + hU) 5 1. Now the probability that X 5 s + hx, for 0 5 x 5 1, is the ratio of area to the left of the vertical line U = x in Fig. 11 to the total area, namely, oz f f(s + hu) du / 6 ;f(s + hu) du = 1 f(v) dv; .I therefore X has the correct distribution.

Leave a Reply