random variables

Download Report

Transcript random variables

RANDOM VARIABLES
• Random variables
• Probability distribution
• Random number generation
– Expected value
– Variance
– Probability distributions
1
RANDOM VARIABLES
• Random variable:
– A variable whose numerical value is determined by the
outcome of a random experiment
• Discrete random variable
– A discrete random variable has a countable number of
possible values.
– Example
• Number of heads in an experiment with 10 coins
• If X denotes the number of heads in an experiment
with 10 coins, then X can take a a value of 0, 1, 2,
…, 10
2
RANDOM VARIABLES
– Other examples of discrete random variable: number of
defective items in a production batch of 100, number of
customers arriving in a bank in every 15 minute,
number of calls received in an hour, etc.
• Continuous random variable
– A continuous random variable can assume an
uncountable number of values.
– Examples
• The time between two customers arriving in a bank,
the time required by a teller to serve a customer,
etc.
3
DISCRETE PROBABILITY DSTRIBUTION
• Discrete probability distribution
– A table, formula, or graph that lists all possible events and
probabilities a discrete random variable can assume
– An example is shown below:
Discrete Probability Distribution
Probability
0.75
0.5
0.25
0
HH
HT
Event
TT
4
CONTINUOUS PROBABILITY DSTRIBUTION
• Continuous probability distribution
– Similar to discrete probability distribution
– Since there are uncountable number of events, all the
events cannot be specified
– Probability that a continuous random variable will assume
a particular value is zero!!
– However, the probability that the continuous random
variable will assume a value within a certain specified
range, is not necessarily zero
– A continuous probability distribution gives probability
values for a range of values that the continuous random
variable may assume
5
f(x)
CONTINUOUS PROBABILITY DSTRIBUTION
z
6
f(x)
CONTINUOUS PROBABILITY DSTRIBUTION
z
7
REVISIT SIMPLE RANDOM SAMPLING
• In Chapter 5, a simple random sample of 10 families is
chosen from a group of 40 families.
– 40 Random numbers are generated
– Each random number is between 0 and 1 (not
including 1)
– Excel RAND() function is used to generate each
random number.
8
REVISIT SIMPLE RANDOM SAMPLING
– What is the average of the random numbers
generated?
– What is the variance of the random numbers
generated?
– What is the standard deviation of the random numbers
generated?
E
9 Average
10 Variance
11 Standard deviation
F
0.5155
0.0856
0.292635444
9
REVISIT SIMPLE RANDOM SAMPLING
– Plot a histogram with all the random numbers, and
comment on the distribution of the random numbers.
Frequency
Histogram
8
7
6
5
4
3
2
1
0
0.125 0.25 0.375
0.5
0.625 0.75 0.875
Random Numbers
1
10
RANDOM NUMBER GENERATION
• Most software can generate discrete and continuous
random numbers (these random numbers are more
precisely called pseudo random numbers) with a wide
variety of distributions
• Inputs specified for generation of random numbers:
– Distribution
– Average
– Variance/standard deviation
– Minimum number, mode, maximum number, etc.
11
RANDOM NUMBER GENERATION
• Next 4 slides
– show histograms of random numbers generated and
corresponding input specification.
– observe that the actual distribution are similar to but
not exactly the same as the distribution desired, such
imperfections are expected
– methods/commands used to generate random
numbers will not be discussed in this course
12
RANDOM NUMBER GENERATION: EXAMPLE
– A histogram of random numbers: uniform distribution,
min = 500 and max = 800
Frequency
Uniform Distribution
25
20
15
10
5
0
Random Numbers
13
RANDOM NUMBER GENERATION: EXAMPLE
– A histogram of random numbers: triangular distribution,
min = 3.2, mode = 4.2, and max = 5.2
Frequency
Triangular Distribution
120
100
80
60
40
20
0
3.2 3.4 3.6 3.8
4
4.2 4.4 4.6 4.8
5
5.2
Radom Numbers
14
RANDOM NUMBER GENERATION: EXAMPLE
– A histogram of random numbers: normal distribution,
mean = 650 and standard deviation = 100
30
25
20
Random Numbers
0
95
0
91
0
87
0
83
0
79
0
75
0
71
0
67
0
63
0
59
0
55
0
51
0
47
0
43
0
39
0
15
10
5
0
35
Frequency
Normal Distribution
15
RANDOM NUMBER GENERATION: EXAMPLE
– A histogram of random numbers: exponential
distribution, mean = 20
Exponential Distribution
30
20
10
Random Numbers
76
71
66
61
56
51
46
41
36
31
26
21
16
11
6
0
1
Frequency
40
16
EXPECTED VALUE AND VARIANCE
• It’s important to compute mean (expected value) and
variance of probability distribution. For example,
– Recall from our discussion on random variables and
random numbers that if we want to generate random
numbers, it may be necessary to specify mean and
variance (along with the distribution) of the random
numbers.
– Suppose that you have to decide whether or not to
make an investment that has an uncertain return. You
may like to know whether the expected return is more
than the investment.
17
EXPECTED VALUE
• The expected value is obtained as follows:
n
E  X    xi p  xi 
i 1
• E(X) is the expected value of the random variable X
• xi is the i-th possible value of the random variable X
• p(xi) is the probability that the random variable X will
assume the value xi
18
EXPECTED VALUE: EXAMPLE
Example 1: Hale’s TV productions is considering producing
a pilot for a comedy series for a major television network.
While the network may reject the pilot and the series, it
may also purchase the program for 1 or 2 years. Hale’s
payoffs (profits and losses in $1000s) and probabilities of
the events are summarized below:
Reject 1 year 2 years
x
-100
50
150
p(x)
0.2
0.3
0.5
What should the company do?
19
LAWS OF EXPECTED VALUE
• The laws of expected value are listed below:
1. E c   c
2. E cX   cE  X 
3. E ( X  Y )  E  X   E Y 
E ( X  Y )  E  X   E Y 
4. E ( XY )  E  X E Y , if X and Y are independen t
• X and Y are random variables
• c is a constant
• E(X), E(Y), and E(c) are expected values of X, Y and c
respectively.
20
LAWS OF EXPECTED VALUE: EXAMPLE
Example 2: If it turns out that each payoff value of Hale’s TV
is overestimated by $50,000, what the company should
do?
21
LAWS OF EXPECTED VALUE: EXAMPLE
Example 3: Tucson Machinery Inc. manufactures Computer
Numerical Controlled (CNC) machines. Sales for the CNC
machines are expected to be 30, 36, 42, and 33 units in
fall, winter, spring and summer respectively. What is the
expected annual sales?
22
LAWS OF EXPECTED VALUE: EXAMPLE
Example 4: Let X be a random variable with the following
probability distribution:
x
-10
0.2
p(x)

Compute E 2 X  5
2
5
20
0.3
0.5

23
VARIANCE
• The variance and standard deviation are obtained as
2
follows:
n
2
Variance,  X2  E  X      xi    p xi 


i 1
Standard deviation,  X   X2
•  is the mean (expected value) of random variable X
• E[(X-)2] is the variance of random variable X, expected
value of squared deviations from the mean
• xi is the i-th possible value of random variable X
• p(xi) is the probability that random variable X will assume
the value xi
24
VARIANCE: EXAMPLE
Example 5: Let X be a random variable with the following
probability distribution:
x
p(x)
-10
0.2
5
20
0.3
0.5
Compute variance.
25
SHORTCUT FORMULA FOR VARIANCE
• The shortcut formula for variance and deviation are as
follows:
Shortcut formula for varian ce,  X2  E X 2    2
Standard deviation,  X   X2
•  is the mean (expected value) of random variable X
• E(X 2) is the expected value of X 2 and is obtained as
n
follows:
2
2
    x px 
E X
i 1
i
i
• xi is the i-th possible value of random variable X
• p(xi) is the probability that random variable X will assume
the value xi
26
SHORTCUT FORMULA FOR VARIANCE
EXAMPLE
Example 6: Let X be a random variable with the following
probability distribution:
x
p(x)
-10
0.2
5
20
0.3
0.5
Compute variance using the shortcut formula.
27
LAWS OF VARIANCE
• The laws of expected value are listed below:
1. V c   0
2. V cX   c 2V  X 
3. V  X  c   V  X 
3. V ( X  Y )  V  X   V Y 
V ( X  Y )  V  X   V Y 
• X and Y are random variables
• c is a constant
• V(X), V(Y), and V(c) are variances of X, Y and c
respectively.
28
LAWS OF VARIANCE: EXAMPLE
Example 7: Let X be a random variable with the following
probability distribution:
x
p(x)
-10
0.2
5
20
0.3
0.5
Compute V 2 X  5
29