Page 43 - Computational Statistics Handbook with MATLAB
P. 43

Chapter 2: Probability Concepts                                  29



                                forfor
                                  mm
                             Uni
                             UUnnii iforform  m
                             Un
                             Perhaps one of the most important distributions is the uniform distribution
                             for continuous random variables. One reason is that the uniform (0, 1) distri-
                             bution is used as the basis for simulating most random variables as we dis-
                             cuss in Chapter 4.
                              A random variable that is uniformly distributed over the interval (a, b) fol-
                             lows the probability density function given by
                                                             1
                                                   (
                                                      ,
                                                  f xa b) =  -----------;  a <  x <  . b   (2.27)
                                                     ;
                                                            b –  a
                             The parameters for the uniform are the interval endpoints, a and b. The mean
                             and variance of a uniform random variable are given by
                                                                a +  b
                                                        EX[] =  -----------  ,
                                                                 2

                             and

                                                               ( b –  a)  2
                                                       VX() =  ------------------  .
                                                                 12

                             The cumulative distribution function for a uniform random variable is


                                                           0;    x ≤  a
                                                           x –  a
                                                   Fx() =   -----------;  a <  x <  b     (2.28)
                                                           b –  a
                                                           1;    x ≥  b.


                             Example 2.4
                             In this example, we illustrate the uniform probability density function over
                             the interval (0, 10), along with the corresponding cumulative distribution
                             function. The MATLAB Statistics Toolbox functions unifpdf and unifcdf
                             are used to get the desired functions over the interval.

                                % First get the domain over which we will
                                % evaluate the functions.
                                x = -1:.1:11;
                                % Now get the probability density function
                                % values at x.
                                pdf = unifpdf(x,0,10);
                                % Now get the cdf.
                                cdf = unifcdf(x,0,10);




                             © 2002 by Chapman & Hall/CRC
   38   39   40   41   42   43   44   45   46   47   48