Math 362 - Computer Lab #4 - Spring 2003
Introduction
to Probability Theory
Computer Lab 4: The expectation of a random variable
In this lab, we will use large random samples as well as plots of probability functions
and density functions to estimate the mean of common random variables.
- The Bernoulli random variable
- Calculate the mean of a Bernoulli random variable with parameter p.
- Create a large random sample (use Calc -> Random Data ->
Bernoulli...) of a Bernoulli random variable with p = 0.75 and find
the sample mean (for instance with Stat -> Basic Statistics ->
Display Descriptive Statistics... ) to check your result.
- Repeat the above for different values of p.
- The binomial random variable
Consider a binomial random variable X with n = 5 and p = 0.75.
- Plot the probability function of this random variable
- Enter the possible values of X in Column C1 and use
Calc -> Probability distributions -> Binomial... to
obtain the corresponding values of the probability function.
- Plot the probability function of X.
- Compute E(X) from the probability function of X.
- Estimate E(X) from a large random sample
- Use Random Data -> Binomial... in the Calc menu to
create a large random sample.
- Use for instance Basic Statistics -> Display Descriptive Statistics...
in the Stat menu to find the mean of your random sample.
- Repeat the procedure with a larger random sample to make sure your estimate of
E(X) is reasonable.
- Find an expression for E(X) in terms of n and p
-
Repeat the above for different values of the parameters n and p
of the random variable. Each time, record your estimate of E(X). Plot the
estimate of E(X) as a function of the product n p. What do you observe?
- The hypergeometric random variable
-
Recall that the random variable giving the number of "successes" when n drawings
without replacement are made from a pool of N items, m of which are "successes"
and N-m of which are "failures" is hypergeometric. Consider a
hypergeometric random variable with N = 20, m = 15 and n = 6.
- Plot the probability function. of this random variable
- Enter the possible values of X in one of the columns of the worksheet and use
Calc -> Probability distributions -> Hypergeometric... to
obtain the corresponding values of the probability function.
- Plot the probability function of X.
- Compute E(X) from the probability function. of X.
- Estimate E(X) from a large random sample
- Use Random Data -> Hypergeometric... in the Calc menu to
create a large random sample.
- Use for instance Basic Statistics -> Display Descriptive Statistics...
in the Stat menu to find the mean of your random sample.
- Repeat the procedure with a larger random sample to make sure your estimate of
E(X) is reasonable.
- Find an expression for E(X) in terms of m, n and N
Repeat the above for different values of the parameters n and m
of the random variable. Each time, record your estimate of E(X). Plot the
estimate of E(X) as a function of the product n m. How are the results
affected by changing the value of N ? Can you come up with an expression for
E(X) in terms of m, n and N ?
- The normal random variable
-
This continuous random variable is extremely important in probability theory because of
the central limit theorem which, loosely speaking, states that many random phenomena
empirically obey a normal distribution, at least approximately. A normal distribution
is specified by two parameters, its mean m and its
standard deviation s. The goal of this section is to
explore how the density function changes when these two parameters are varied.
- Plot the density function of a normal random variable
Use for instance m = 0 and s = 1.
Make sure you generate enough data points: recall that this is a continuous random
variable and that your graph of the density function should look continuous.
- Change the parameters and replot the density function
- Change the mean but keep the standard deviation constant.
What do you see?
- Change the standard deviation while keeping the mean constant. What do you observe?
Back to Math 362