Page 123 - Computational Statistics Handbook with MATLAB
P. 123

110                        Computational Statistics Handbook with MATLAB


                             4.9. Run Example 4.4 and generate 500 random variables. Plot a histogram
                                of the variates. Does it match the probability density function shown
                                in Figure 4.3?
                             4.10. Implement Example 4.5 in MATLAB. Generate 100 random variables.
                                What is the relative frequency of each value of the random variable
                                    ,
                                 ,
                                1 … 5  ? Does this match the probability mass function?
                                                                               ,,
                                                                                    ,
                             4.11. Generate four sets of random variables with  ν =  25 15 20,   using
                                the function cschirnd. Create histograms for each sample. How does
                                                                                          ν
                                the shape of the distribution depend on the degrees of freedom  ?
                             4.12. Repeat Example 4.13 for larger sample sizes. Is the agreement better
                                between the observed relative frequencies and the theoretical values?
                             4.13. Generate 1000 binomial random variables for  n =    5   and
                                       ,
                                           ,
                                p =  0.3 0.5 0.8.   In each case, determine the observed  relative fre-
                                quencies and the corresponding theoretical probabilities. How is the
                                agreement between them?
                             4.14. The MATLAB Statistics Toolbox has a GUI called randtool. This
                                is an interactive demo that generates random variables from distri-
                                butions that are available in the toolbox. The user can change param-
                                eter values and see the results via a histogram. There are options to
                                change the sample size and to output the results. To start the GUI,
                                simply type randtool at the command line. Run the function and
                                experiment with the distributions that are discussed in the text (nor-
                                mal, exponential, gamma, beta, etc.).
                             4.15. The plot on the right in Figure 4.6 shows a histogram of beta random
                                variables with parameters  α =  β =  0.5  . Construct a similar plot
                                using the information in Example 4.9.





























                            © 2002 by Chapman & Hall/CRC
   118   119   120   121   122   123   124   125   126   127   128