Page 92 - Computational Statistics Handbook with MATLAB
P. 92

Chapter 4




                             Generating Random Variables










                             4.1 Introduction
                             Many of the methods in computational statistics require the ability to gener-
                             ate random variables from known probability distributions. This is at the
                             heart of Monte Carlo simulation for statistical inference (Chapter 6), boot-
                             strap and resampling methods (Chapters 6 and 7), Markov chain Monte
                             Carlo techniques (Chapter 11), and the analysis of spatial point processes
                             (Chapter 12). In addition, we use simulated random variables to explain
                             many other topics in this book, such as exploratory data analysis (Chapter 5),
                             density estimation (Chapter 8), and statistical pattern recognition
                             (Chapter 9).
                              There are many excellent books available that discuss techniques for gen-
                             erating random variables and the underlying theory; references will be pro-
                             vided in the last section. Our purpose in covering this topic is to give the
                             reader the tools they need to generate the types of random variables that
                             often arise in practice and to provide examples illustrating the methods. We
                             first discuss general techniques for generating random variables, such as the
                             inverse transformation and acceptance-rejection methods. We then provide
                             algorithms and MATLAB code for generating random variables for some
                             useful distributions.






                             4.2 General Techniques for Generating Random Variables



                                  m
                                    Numbe
                                for
                                  m
                                      Numbe
                                      Numbe
                                     Random
                                     Random
                              ni
                             U
                             U
                             Un
                             U n i ii for for for m  m Random Random r Numbe  rs r r s s s
                              n
                             Most methods for generating random variables start with random numbers
                                                                        ,
                                                                       (
                             that are uniformly distributed on the interval  01)  . We will denote these
                             random variables by the letter U. With the advent of computers, we now have
                            © 2002 by Chapman & Hall/CRC
   87   88   89   90   91   92   93   94   95   96   97