Math 362 - Computer Lab #7 - Spring 2003
Introduction
to Probability Theory
Computer Lab 7: Random numbers
In this lab, we will see how to plot an approximation of the density function of
a continuous random variable, given a large random sample for this
random variable. We will also see how to generate random numbers
according to a given continuous distribution.
- How to plot an approximation of the distribution of a continuous
random variable
- Use MINITAB to create 10000 rows of random numbers from a normal distribution with
mean 0 and variance 1. Store the data in Column C1.
- Repeat the above with 1000 rows of data, and store the results in Column C2.
- Use Graph -> Histogram... to plot a histogram of the data in Columns C1
and C2. Click on Frame -> Multiple Graphs... and choose the option Overlay
graphs on the same page, to see both graphs at the same time.
- Are the two plots similar? Why or why not? Can you see why there is a problem?
- Plot a histogram again, but now click on Options... and select Percent under
Type of Histogram. Is the result satisfactory? Why or why not?
- Repeat the above with Density selected under Type of Histogram. Is the result
satisfactory? Why or why not?
- Based on the above results, what do you think is the best way to plot an approximation of
the density function of a random variable, given a large random sample for this random variable?
- Two views of the exponential random variable.
- Choose a positive constant b.
- Graph the distribution
function F of an exponential random variable
with parameter b is 0 if x is negative
and 1 - exp(bx) if x is positive.
- Find the inverse function for F.
- Use MINITAB to create 10000 rows of random numbers from a exponential
distribution with mean 1/b.
Store the data in Column C3.
- Use MINITAB to create 10000 rows of random numbers from a uniform
distribution on [0,1]. Store the data in Column C4.
- Let C5 = -LOGE(1-C4)/b
- Overlay the histograms of C3 and C5 and compare.
- Let Y be a uniform random variable on [0,1]
and compute Pr{-ln(1-Y)/b
< x}
- How to generate random numbers according to a given continuous distribution
Suppose we want to create random numbers according to a Pareto distribution
function F(x) = 1 - (x/x0)a+1 supported on the interval [x0,¥). Here both x0 and a
are positive. Let X be a random variable having this
distribution.
- Choose values for x0 and a. Graph the distribution function F of X.
- Find a formula for this density function and give a graph.
- If Y = F ( X ), find X in terms of Y.
In other words, find the inverse function for F.
- We will see that Y has a uniform distribution on [0,1]. Use this information to generate
a random sample for X of size 10000.
- Check your result by using this random sample to plot an approximation of the density function of
X.
Back to Math 362