211ch8random Variable
211ch8random Variable
If a random variable is discrete, then the set of all values that it can assume with non-zero
probability is finite or countably infinite, because the sum of uncountably many positive
real numbers (which is the least upper bound of the set of all finite partial sums) always
diverges to infinity.
Given a random experiment with an outcome space S, a function X that assigns to each
element s in S one and only one real number X(s) = x is called a random variable, like a
function of s. The space of X is the set of real numbers {x : X (s) x, s S} , where s S
means the element s belongs to S. The probability mass function (pmf) f ( x) of a
discrete random variable X is a function that satisfies the following properties:
1. f ( x) 0, x S;
2. f ( x) 1;
x S
3. P( X A) f ( x), A S
x A
Example 1. Suppose that X has a discrete uniform distribution on S {1, 2,3, 4,5,6} and
1
its pmf is f ( x) , x 1, 2,3, 4,5,6 .
6
1
As a general case we may write pmf as f ( x) , x 1, 2,3, 4,, m
m
Example 2. Roll a 4 –sided die twice and let X equal the larger of the two outcomes if
they are different and common value if they are the same. The outcome space for this
experiment is S0 {(d1 , d 2 ); d1 1, 2,3, 4; d 2 1, 2,3, 4} , where we assume that each of
1
these 16 points has probability . Then
16
1 3 5
P( X 1) P[(1,1)] , P( X 2) P[{(1, 2),(2, 2),(2,1)] , P( X 3)] and
16 16 16
7
P( X 4) . Looking at the pattern one can easily find the pmf
16
1
2x 1
f ( x) , x 1, 2,3, 4
16
Exercise
x
1. Let the pmf of X be defined by f ( x) ,x 2,3, 4 , a) draw a bar graph and a
9
b) probability histogram
2. For each of the following, determine the constant c, so that f ( x) satisfies the
conditions of being a pmf for a random variable X,
x
a) f ( x) , x 1, 2,3, 4
c
b) f ( x) cx, x 1, 2,3, 410
x
1
c) f ( x) c , x 1, 2,3, 4
4
d) f ( x) c(1 x) 2 , x 0,1, 2,3
x
e) f ( x) , x 1, 2,3, 4,, n
c
In probability theory and statistics, the expected value (or expectation value, or
mathematical expectation, or mean, or first moment) of a random variable is the
integral of the random variable with respect to its probability measure.
For discrete random variables this is equivalent to the probability-weighted sum of the
possible values.
The term "expected value" can be misleading. It must not be confused with the "most
probable value." The expected value is in general not a typical value that the random
variable can take on. It is often helpful to interpret the expected value of a random
variable as the long-run average value of the variable over many independent repetitions
of an experiment.
2
x
Example 1. Let X have the pmf f ( x) , x 1, 2,3, 4 . Find E ( X )
10
x
x
Solution: E ( X ) xi f ( xi ) x 3 , verify.
x 1 10
x
Example 2. Let X have the pmf f ( x) , x 1, 2,3 . Find mean = E ( X ) and also
6
E ( X 2 ) and variance 2 E ( X 2 ) ( E ( X )) 2 and also standard deviation .
x
x 7
Solution: Mean = E ( X ) xi f ( xi ) x
x 1 6 3
x
x 36
E( X 2 ) xi 2 f ( xi ) x2 6
x 1 6 6
2
2 2 7 2 5 5
Variance E ( X ) ( E ( X )) 6 and
3 9 3
Example 3. A politician can emphasize jobs or the environment in her election
campaign. The voters can be concerned about jobs or the environment. A payoff matrix
showing the utility of each possible outcome is shown.
Jobs Voters Environment
Jobs 25 10
Environment 15 30
The political analysts feel there is a 0.39 chance that the voters will emphasize
jobs. Which strategy should the candidate adopt to gain the highest utility
a) Environment b) Jobs
Explain mathematically.
Solution: For the environment the expected value is E( x) 15(.39) 30(1 .39) 12.45
On the other hand for jobs the expected value is E( x) 25(.39) 10(1 .39) 3.65 . So
the preference will go for a) Environment (because of higher expected value).
Exercise
3
Section 8.2 Bernoulli trials and the Binomial distribution
Example 2. In the instant lottery with 20% winning tickets, if X is equal to the number of
winning tickets among n = 8 that are purchased, the probability of purchasing at best 6
winning tickets is
8 8
P( X 6) 1 f (7) f (8) 1 (0.20)7 (1 0.2)1 (0.2)8 0.99991552
7 8
One may use calculator as follows (TI)
2nd DISTR A (binomcdf) (8, 0.20, 6) will display 0.99991552
Example 3. In the instant lottery with 20% winning tickets, if X is equal to the number of
winning tickets among n = 8 that are purchased. Find the probability of purchasing at
least 6 winning tickets.
Hint. Find P( X 6) P( X 6) P( X 7) P( X 8) or
P( X 6) 1 P( X 5) 1 binomcdf (8,.2,5)
Example 4. A quiz consists of 24 multiple choice questions. Each question has 5 possible
answers, only one of which is correct. If you answer the questions completely based on
guessing, what is the probability that
4
4
Solution: The probability that you will answer one question wrong is 0.8 .
5
a) The probability of answering exactly 4 wrong is a binomial probability of
24
B(24, 0.8, 4), which is P( X 4) B(24, 0.8, 4) (0.8) 4 (0.2) 20 4.56 10 11
,
4
which is almost zero.
If you use TI calculator use binompdf (24, 0.8, 4). Check your calculator using the
following code:
b) The probability that you will answer exactly 4 correct is B(24, 0.2, 4) = 0.196
c) At least 20 correct P( X 20)
= 20 correct + 21 correct + 22 correct + 23 correct + 24 correct = 4.79 10 11 .
12
d) At most three wrong: P( X 3) binomcdf (24, 0.8,3) 2.25 10
e) At most three correct: P( X 3) binomcdf (24,0.2,3) 0.264
5
Solution: P( X 9) 1 binomcdf (10, 0.25,8) 2.95639 10
Example 8. A student claims that he has extrasensory perception (ESP). A coin is flipped
25 times, and a student is asked to predict the outcome in advance. He gets 20 out of 25
correct. What was the probability that he would have done at least this well if he had no
EPS?
Exercise 1. Toss a fair coin 12 times. How many possible outcomes do you have? What
is the probability of getting a) exactly 7 heads, b) at least 7 heads, c) at most 7 heads?
5
Exercise 2. A student claims that he has extrasensory perception (ESP). A coin is flipped
30 times, and a student is asked to predict the outcome in advance. He gets 25 out of 30
correct. What was the probability that he would have done at least this well if he had no
EPS?
Exercise 3. A quiz consists of 20 multiple choice questions, each with 5 possible choices.
For someone who makes random guesses for all of the questions, find the probability of
passing if the minimum passing grade is 80%.
Example 4. A computer manufacturer tests a random sample of 30 computers. The
7
probability that a computer is defective is 7 %. What is the probability that:
8
a) Exactly 7 computers are defective?
b) At least two computers are defective?
c) At most two computers are defective?
Exercise 5. In the instant lottery with 10% winning tickets, if X is equal to the number of
winning tickets among 20 tickets that are purchased, find the probability of purchasing
a) at best 7 winning tickets,
b) at least 7 winning tickets,
c) no more than 6 winning tickets,
d) no less than 6 winning tickets
Exercise 6. The rates of on-time flights for commercial jets are continuously tracked by
the U.S Department of transportation. Recently, Southwest Air had the best rate with
80% of its flights arriving on time. A test is conducted by randomly selected 16
Southwest flights and observing whether they arrive on time. Find
a) the probability that exactly 4 flights arrive on time
b) The probability that at least 4 flights arrive on time
c) At best 4 flights arrive on time
6
x / 20
e
Example 1. Evaluate the integral dx
0
20
x / 20
e x / 20 b
Solution: dx lim e 1
0
20 b 0
mx
e
Example 2. Show that f ( x) , 0 x is a probability density function.
m
x/m
e
Solution (Hint): Show that f ( x) 0 and dx 1
m 0
G( y) 2t dt y2 0 y 1
0
1 1 y
1
2
Find mean E (Y ) yg ( y )dy (check the integral) and
0
3
1
2 2 2 1
Variance Var (Y ) E (Y ) y 2 g ( y )dy 2
(check the integral). Find
0
18
also the standard deviation .
0 1 2
F(1) = 1/2 and F(2) = 1. We also notice that distribution function is zero, i.e., F (0) 0
when x < 0.
The distribution function over the interval 0 x 1 is
x2
F ( x) (1 x 1)dx (1 (1 x) dx x dx c, c 0,as F (0) 0
2
The distribution function over the interval 1 x 2 is
x2 1
F ( x) (1 x 1)dx (1 x 1) dx (2 x)dx 2x c, c 1, as F (1)
2 2
The distribution function over the interval 2 x is
7
F ( x) f ( x) dx 0 dx c 1, as F (2) 1
0 x 0
2
x
, 0 x 1
F ( x) 2
x2
2x 1, 1 x 2
2
1 x 2
You can calculate mean, standard deviation and variance. Look at example 3.
Exercise:
1. For each of the following functions, i) find the constant c so that f (x) is a pdf of
the random variable X, ii) find the distribution function F(x) P( X x) and iii)
sketch f (x) and F(x), iv) find also , 2 , .
8
x3
a) f ( x) ,0 x c
4
3x 2
b) f ( x) , c x c
16
c) f ( x) 4 x c , 0 x 1
d) f ( x) c x , 0 x 4
2. Sketch the graph of the following pdf f (x), then find and sketch the probability
distribution function F(x) on the real line. Review example 4.
3x 2
a) f ( x) , 1 x 1
2
1
b) f ( x) , 1 x 1
2
1 x, 1 x 0
c) f ( x)
1 x, 0 x 1
2
A normal distribution of a random variable X with mean and variance is a statistic
distribution with probability density function (pdf)
(1)
on the domain . While statisticians and mathematicians uniformly use the term
"normal distribution" for this distribution, physicists sometimes call it a Gaussian
distribution and, because of its curved flaring shape, social scientists refer to it as the
"bell curve."
9
The normal distribution is an extremely important probability distribution in many
fields. It is a family of distributions of the same general form, differing in their location
and scale parameters: the mean ("average") and standard deviation ("variability"),
respectively. The standard normal distribution is the normal distribution with a mean
of zero and a standard deviation of one (the green curve in the plots below). It is often
called the bell curve because the graph of its probability density resembles a bell.
10
Important Information: All normal density curves satisfy the following property which
is often referred to as empirical rule:
1. 68.26% of the observations fall within 1 standard deviation of mean.
2. 95.44% of the observations fall within 2 standard deviation of mean
3. 99.74% of the observations fall within 3 standard deviation of mean
Note: Within 5 standard deviation of mean we assume 100% data points.
Example 1. Find the mean and standard deviation of the normal distribution whose pdf is
1 ( x 7)2
given as f ( x) exp
128 128
Solution: Compare with the standard formula of pdf for the normal distribution and find
that 8, 7.
Example 2. Write the pdf of a normal distribution with mean 3 and variance 16.
Example 3. Find the area under the normal curve with mean zero and standard deviation
one for the standard variate z 1.24 .
0 1.24
Using calculator: P( z 1.24) 0.8925 89.25%
The calculator code:
Example 4. Find the area under the normal curve with mean zero and standard deviation
one for the standard variate z 1.24 .
0 1.24
11
Using calculator: P( z 1.24) 0.1075 10.75%
The calculator code: 2nd DISTR 2 normalcdf ( 1.24, 5) =0.1074875
Example 5. Find the area under the normal curve with mean zero and standard deviation
one for 0.12 z 1.24 .
-0.12 0 1.24
Using calculator: P( 0.12 z 1.24) 0.4402707 44.03%
The calculator code:
Example 6. Suppose x is a normally distributed random variable with mean 10.2 and
standard deviation 1.5. Find each of the following probabilities.
a) P(6.1 x 13.3) .
b) P(9.4 x 13)
c) P(15.5 x 13.1)
d) P( x 11.6)
e) P( x 14.4)
Draw normal curve and show the region bounded by the normal curve and the x values.
11.6 10.2
d) P( x 11.6) normalcdf ,5 17.53%
1.5
Try for e).
6.1 10.2 13.3
Exercise Set
1. The physical fitness of an athlete is often measured by how much oxygen the
athlete takes in (which is recorded in millimeters per kilogram, ml/kg). The
maximum oxygen uptake for elite athletes has been found to be 80 with a standard
deviation 9.2. Assume that distribution is approximately normal.
a) What is the probability that an elite athlete has a maximum oxygen uptake of
at least 75 ml/kg? Answer: 70.66%
12
b) What is the probability that an elite athlete has a maximum oxygen uptake of
65 ml/kg or lower? Answer: 5.15%
c) Consider someone with a maximum oxygen uptake of 26 ml/kg. Is it likely
that this person is an elite athlete? Answer: No
2. The combined score of SAT – 1 test are normally distributed with mean of 998
and a standard deviation of 202. If a college includes a minimum score of 800
among its requirements, what percentage of students do not satisfy that
requirement? Answer: 16.35%
3. IQ score are normally distributed with mean of 100 and a standard deviation 15.
Mensa is an international society that has one – and only one qualification for
membership, a score in the top 2 on an IQ test.
4. Using diaries for many weeks, a study on the lifestyle of visually impaired
students was conducted. The students kept track of many lifestyle variables
including how many hours of sleep obtained on a typical day. Researchers found
that visually impaired students averaged 9.6 hours of sleep, with a standard
deviation of 2.56 hours. Assume that the number of hours of sleep for these
visually impaired students is normally distributed.
a) What is the probability that a visually impaired student gets less than 6.1
hours of sleep? Answer: 8.58%
b) What is the probability that a visually impaired student gets between 6.3 and
10.35 hours of sleep? Answer: 51.65%
c) Forty percent of students get less than how many hours of sleep on a typical
day? Answer: 8.95 hours
5. Healthy people have body temperatures that are normally distributed with a mean
of 98.20 degree Fahrenheit and a standard deviation of 0.62 degree Fahrenheit.
a) If a healthy person is randomly selected, what is the probability that he or she
has a body temperature above 98.9 degree Fahrenheit? Answer: 12.94%
b) A hospital wants to select a minimum temperature for requiring further
medical tests. What should that temperature be, if we want only 1% of healthy
people to exceed it? Answer: hint: (x-98.2)/.62 = invnorm(0.99), 99.64
13
7. Suppose a population is normally distributed with a mean of 24.6 and a standard
deviation of 1.3. What percent of the data will lie between 25.3 and 26.8?
Answer: 24.91%
14