Page 91 - Computational Statistics Handbook with MATLAB
P. 91

Chapter 3: Sampling Concepts                                     77


                                the smallest observation in your random sample? What is the value
                                of the empirical cumulative distribution function evaluated at a point
                                that is greater than the largest observation in your random sample?
                             3.8. Generate a  random sample of size 100  from a normal distribution.
                                What are the estimated quartiles?
                             3.9. Generate a random sample of size 100 from a uniform distribution
                                (use the MATLAB function rand to generate the samples). What are
                                                                   ,
                                                                        ,
                                                               ,
                                the sample quantiles for  p =  0.33 0.40 0.63 0.90  ? Is  this what you
                                would expect from theory?
                             3.10. Write a MATLAB function that will return the sample quartiles based
                                on the general definition given for sample quantiles (Equation 3.44).
                             3.11. Repeat Examples 3.5 and 3.6 for larger sample sizes. Do your esti-
                                mates for the quartiles get closer to the theoretical values?
                             3.12. Derive the median for an exponential random variable.
                             3.13. Calculate the quartiles for the exponential distribution.
                             3.14. Compare the values obtained for the estimated quartiles in Example
                                3.6 with the theoretical quantities. You can find the theoretical quan-
                                tities using norminv. Increase the sample size to n =  1000  . Does your
                                estimate get better?
                             3.15. Another measure of skewness, called the quartile coefficient of
                                skewness, for a sample is given by

                                                          ˆ
                                                                ˆ
                                                    ˆ    q 0.75 –  2q 0.5 +  ˆ q 0.25
                                                    γ1 =  ------------------------------------------  .
                                                      q     ˆ     ˆ
                                                            q 0.75 –  q 0.25
                                Write a MATLAB function that returns this statistic.
                             3.16. Investigate the bias in the maximum likelihood estimate of the vari-
                                ance that is given in Equation 3.28. Generate a random sample from
                                the standard normal  distribution.  You can use the  randn function
                                that is available in the standard MATLAB package. Calculate σ   using
                                                                                      ˆ 2
                                Equation 3.28 and record the value in a vector. Repeat this process
                                (generate  a random sample  from the standard normal distribution,
                                estimate the variance, save the value) many times. Once you are done
                                with this procedure, you should have many estimates for the variance.
                                Take the mean of these estimates to get an estimate of the expected
                                value of σ ˆ 2  . How does this compare with the known value of σ =  1  ?
                                                                                       2
                                Does this indicate that the maximum likelihood estimate for the vari-
                                ance is biased? What is the estimated bias from this procedure?










                            © 2002 by Chapman & Hall/CRC
   86   87   88   89   90   91   92   93   94   95   96