28.11.2014 Views

THE EGS5 CODE SYSTEM

THE EGS5 CODE SYSTEM

THE EGS5 CODE SYSTEM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The result of this algorithm is that ˆx will have the density function f given by<br />

n∑<br />

f(x) = α i f i (x) g i (x) . (2.22)<br />

i=1<br />

Thus, if we have a function f which can be put in this form for which the f i can be sampled<br />

easily and the g i evaluated relatively easily, then we have a good method of sampling from f. It<br />

can be shown that the mean number of tries to accept a value is ∑ α i . If all the g i = 1, we have<br />

the pure “composition” method; and if n = 1, we have the pure “rejection” method. For short we<br />

will call this the “mixed” method. We shall sometimes use the mixed method for some of the f i<br />

also. In these cases we will use the notation (for example)<br />

and so on.<br />

f 2 (x) =<br />

n 2 ∑<br />

i=1<br />

α 2j f 2j (x) g 2j (x) . (2.23)<br />

Finally, we consider the problem of sampling from a joint density function f(x 1 , x 2 , . . . , x n ).<br />

Define the marginal density functions<br />

∫<br />

g m (x 1 , x 2 , . . . , x m ) = f(x 1 , x 2 , . . . , x n ) dx m+1 dx m+2 . . . dx n<br />

∫<br />

= g m+1 (x 1 , x 2 , . . . , x m , x m+1 ) dx m+1 .<br />

We see that g n = f. Now consider h m given by<br />

We see that<br />

(2.24)<br />

h m (x m |x 1 , x 2 , . . . , x m−1 ) ≡ g m (x 1 , x 2 , . . . , x m )/g m−1 (x 1 , x 2 , . . . , x m−1 ) . (2.25)<br />

∫<br />

h m (x m |x 1 , x 2 , . . . , x m−1 ) dx m = 1 (2.26)<br />

from the definition of the g’s. We see that h m is the conditional density function for x m given the<br />

specified values for x 1 , x 2 , . . . , x m−1 . It can be easily seen that f can be factored into a product<br />

of the h’s; namely,<br />

f(x 1 , x 2 , . . . , x n ) = h 1 (x 1 ) h 2 (x 2 |x 1 ) h 3 (x 3 |x 1 , x 2 ) . . . (2.27)<br />

. . . h n (x n |x 1 , x 2 , . . . , x n−1 ) .<br />

The procedure then is to get a sample value x 1 using density function h 1 . Then use this value x 1 to<br />

determine a density function h 2 (x 2 |x 1 ) from which to sample x 2 . Similarly, the previously sampled<br />

x 1 , x 2 , . . . , x m determine the density function h m+1 (x m+1 |x 1 , x 2 , . . . , x m ) for x m+1 . This scheme<br />

is continued until all x i have been sampled. Of course, if the ˆx i are independent random variables,<br />

the conditional densities will just be the marginal densities and the variables can be sampled in<br />

any order.<br />

There are other methods analogous to the one-dimensional sampling methods which can be<br />

used for sampling joint distributions. The reader is referred to the references cited above for more<br />

details.<br />

25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!