Upload
inderjeet782
View
229
Download
0
Embed Size (px)
Citation preview
8/2/2019 04 Discrete and Continuous Random Variables
1/29
Random Variables
Discrete and Continuous
Friday, April 20, 2012 1Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
2/29
Data Types
Data
Numerical Qualitative
Discrete Continuous
Friday, April 20, 2012 2Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
3/29
7.3
Random Variables
A random variable is a function or rule that assigns anumber to each outcome of an experiment.Basically itis just a symbol that represents the outcome of anexperiment.
X = number of heads when the experiment is flipping acoin 20 times.
C = the daily change in a stock price.
R = the number of miles per gallon you get on your
auto during a family vacation. Y = the amount of medication in a blood pressure pill.
V = the speed of an auto registered on a radar detectorused on I-20
Friday, April 20, 2012 Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
4/29
Types of
Random Variables
Discrete Random Variable
Whole Number (0, 1, 2, 3 etc.)
Countable, Finite Number of Values
Jump from one value to the next and cannot take any values in
between.
Continuous Random Variables
Whole or Fractional Number
Obtained by Measuring
Infinite Number of Values in Interval
Too Many to List Like Discrete Variable
Friday, April 20, 2012 4Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
5/29
7.5
Types of Random Variables
Discrete Random Variable usually count data [Number of]
one that takes on a countable number of values this means you can sit downand list all possible outcomes without missing any, although it might take youan infinite amount of time.
X = values on the roll of two dice: X has to be either 2, 3, 4, , or 12.
Y = number of accidents on the XYZ campus during a week: Y has to be 0, 1, 2,3, 4, 5, 6, 7, 8, real big number
Continuous Random Variable usually measurement data [time, weight,distance, etc]
one that takes on an uncountable number of values this means you cannever list all possible outcomes even if you had an infinite amount of time.
X = time it takes you to drive home from class: X > 0, might be 30.1 minutesmeasured to the nearest tenth but in reality the actual time is30.10000001. minutes?)
Exercise: try to list all possible numbers between 0 and 1.
Friday, April 20, 2012 Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
6/29
Discrete random variable
A discrete random variable is one which may take on only acountable number of distinct values such as 0, 1, 2, 3, 4, ...
Discrete random variables are usually (but not necessarily)
counts. If a random variable can take only a finite number ofdistinct values, then it must be discrete.
Examples of discrete random variables include the number ofchildren in a family, the Friday night attendance at a cinema,
the number of patients in a doctor's surgery, the number ofdefective light bulbs in a box of ten.
Friday, April 20, 2012 6Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
7/29
Discrete Random Variable
Examples
Experiment Random
Variable
Possible
Values
Children of One Gender
in Family
# Girls 0, 1, 2, ..., 10?
Answer 33 Questions # Correct 0, 1, 2, ..., 33
Count Cars at Toll
Between 11:00 & 1:00
# Cars
Arriving0, 1, 2, ...,
Open Check in Lines # Open 0, 1, 2, ..., 8
8/2/2019 04 Discrete and Continuous Random Variables
8/29
Discrete
Probability Distribution
1. List of All possible [x, p(x)] pairs
x= Value of Random Variable (Outcome)
p(x) = Probability Associated with Value
2. Mutually Exclusive (No Overlap)
3. Collectively Exhaustive (Nothing Left Out)
4. 0 p(x) 1
5. p(x) = 1
Friday, April 20, 2012 8Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
9/29
Marilyn says: It may sound strange, but more families of 4 children
have 3 of one gender and one of the other than any other
combination. Explain this.
Construct a sample space and look at the total number of ways
each event can occur out of the total number of combinations
that can occur, and calculate frequencies.
Sample Space
BBBB
GBBB
BGBB
BBGB
BBBG
GGBB
GBGB
GBBG
BGGB
BGBG
BBGG
BGGG
GBGG
GGBG
GGGBGGGG
P (girl) = 1/2P (boy) = 1/2
so, P (BBBB) = x x x = 1/16
Are all 16 combinations equally likely? Is the sex ofeach child independent of the other three?
If you have a family of four, what is the probability of
P(all girls or all boys) =
P (2 boys, 2 girls)=
P(3 boys, 1 girl or 3 girls, 2 boy)=8/16=4/8=1/2 8 ways to have 3 of 1 and 2 ofthe other.
6/16 = 3/8 six different ways to have 2 boys and 2 girls
2/16 = 1/8
Friday, April 20, 2012 9Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
10/29
What is the probability of exactly 3 girls in 4 kids?
What is the probability of at least 3 girls in 4 kids?
Assume the random variable X represents the number of girls in a
family of 4 kids. (lower case x is a particular value of X, ie: x=3 girls in
the family)
P(X=3) = 4/16
Sample Space
BBBB
GBBB
BGBB
BBGB
BBBG
GGBB
GBGB
GBBG
BGGB
BGBG
BBGG
BGGG
GBGG
GGBG
GGGBGGGG
Random Variable X
x=0
x=1
x=1
x=1
x=1
x=2
x=2
x=2
x=2
x=2x=2
x=3
x=3
x=3
x=3
x=4
Number ofGirls, x
Probability,P(x)
0 1/16
1 4/16
2 6/16
3 4/16
4 1/16
Total 16/16=1.00
P(X3) = 5/16Friday, April 20, 2012 10Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
11/29
Visualizing Discrete Probability
Distributions
Probability, P(x)
1/16
6/16
4/16 4/16
1/16
0.00
0.05
0.10
0.15
0.20
0.25
0.30
0.35
0.40
0 1 2 3 4
Number of Girls, x
P(x)
Listing TableNumber of Girls, x Probability, P(x)
0 1/16
1 4/16
2 6/16
3 4/16
4 1/16
Total 16/16=1.00
{(0,1/16), (1,.25), (2,3/8),(3,.25),(4,1/16) }
Graph
X is random and x is fixed. We can
calculate the probability that
different values of X will occur and
make a probability distribution.
Friday, April 20, 2012 11Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
12/29
Probability Distributions
Probability, P(x)
1/16
6/16
4/16 4/16
1/16
0.00
0.05
0.10
0.15
0.200.25
0.30
0.35
0.40
0 1 2 3 4
Number of Girls, x
P(x)
Probability distributionscan be written as probability histograms.
Cumulative probabilities: Adding up probabilities of a range of values.
8/2/2019 04 Discrete and Continuous Random Variables
13/29
Discrete example: roll of a die
x
p(x)
1/6
1 4 5 62 3
xall
1P(x)
Friday, April 20, 2012 13Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
14/29
Probability mass function (pmf)
x p(x)
1 p(x=1)=1/6
2 p(x=2)=1/6
3 p(x=3)=1/6
4 p(x=4)=1/6
5 p(x=5)=1/6
6 p(x=6)=1/6
1.0Friday, April 20, 2012 14Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
15/29
Cumulative distribution function
(CDF)
x
P(x)
1/6
1 4 5 62 3
1/3
1/2
2/3
5/6
1.0
Friday, April 20, 2012 15Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
16/29
Cumulative distribution function
x P(xA)
1 P(x1)=1/6
2 P(x2)=2/6
3 P(x3)=3/6
4 P(x4)=4/6
5 P(x5)=5/6
6 P(x6)=6/6
Friday, April 20, 2012 16Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
17/29
Data Types
Data
Numerical Qualitative
Discrete Continuous
Friday, April 20, 2012 17Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
18/29
Continuous Random Variable
A variable with many possible values at all
intervals
Friday, April 20, 2012 18Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
19/29
Continuous Random Variable
Examples
Experiment Random
Variable
Possible
Values
Weigh 100 People Weight 45.1, 78, ...
Measure Part Life Hours 900, 875.9, ...
Ask Food Spending Spending 54.12, 42, ...
Measure Time
Between Arrivals
Inter-Arrival
Time
0, 1.3, 2.78, ...
8/2/2019 04 Discrete and Continuous Random Variables
20/29
Continuous Probability Density
Function
1. Mathematical Formula
2. Shows All Values, x, &
Frequencies, f(x) f(X) Is NotProbability
3. Properties
Area under curve sums to 1
Can add up areas of function to
get probability less than a
specific value Value
(Value, Frequency)
Frequency
f(x)
a bx
8/2/2019 04 Discrete and Continuous Random Variables
21/29
Continuous Random Variable
Probability
Probability Is Area
Under Curve!
1984-1994 T/Maker Co.
P c x d( )
f(x)
Xc d
8/2/2019 04 Discrete and Continuous Random Variables
22/29
Consider the following table of sales,
divided into intervals of 1000 units each,
interval
(0,1000]
(1000,2000](2000,3000]
(3000,4000]
(4000,5000]
(5000,6000]
(6000,7000]
Friday, April 20, 2012 22Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
23/29
and the relative frequency of each interval.
interval relativefreq.
(0,1000] 0
(1000,2000] 0.05
(2000,3000] 0.25
(3000,4000] 0.30
(4000,5000] 0.25
(5000,6000] 0.10
(6000,7000] 0.05
1.00Friday, April 20, 2012 23Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
24/29
Were going to divide the relative frequencies
by the width of the cells (which here is 1000).
This will make the graph have an area of 1.
intervalrelative
freq.
(0,1000] 0 0
(1000,2000] 0.05 0.00005
(2000,3000] 0.25 0.00025
(3000,4000] 0.30 0.00030
(4000,5000] 0.25 0.00025
(5000,6000] 0.10 0.00010
(6000,7000] 0.05 0.00005
widthcell
freq.relativef(x)
Friday, April 20, 2012 24Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
25/29
Graph
interval
(0,1000] 0
(1000,2000] 0.00005
(2000,3000] 0.00025(3000,4000] 0.00030
(4000,5000] 0.00025
(5000,6000] 0.00010
(6000,7000] 0.00005
widthcell
freq.relativef(x)
0 1000 2000 3000 4000 5000 6000 7000
sales
f(x) = p(x)
0.00030
0.00025
0.00020
0.00015
0.00010
0.00005
0
The area of each bar is the frequency of the category, so the
total area is 1.Friday, April 20, 2012 25Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
26/29
Graph
interval
(0,1000] 0
(1000,2000] 0.00005
(2000,3000] 0.00025(3000,4000] 0.00030
(4000,5000] 0.00025
(5000,6000] 0.00010
(6000,7000] 0.00005
widthcell
freq.relativef(x)
0 1000 2000 3000 4000 5000 6000 7000
sales
f(x) = p(x)
0.00030
0.00025
0.00020
0.00015
0.00010
0.00005
0
Here is the frequency polygon.Friday, April 20, 2012 26Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
27/29
If we make the intervals 500 units instead of 1000, the
graph would probably look something like this:
sales
f(x) = p(x)
The height of thebars increases and
decreases more
gradually.
Friday, April 20, 2012 27Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
28/29
If we made the intervals infinitesimally small, the bars
and the frequency polygon would become smooth,
looking something like this:
f(x) = p(x)
sales
This what the distribution
of a continuous random
variable looks like.
This curve is denoted f(x) or
p(x) and is called the
probability density
function.
Friday, April 20, 2012 28Dr. S. Jain
8/2/2019 04 Discrete and Continuous Random Variables
29/29
pmf versus pdf
For a discrete random variable, we had aprobability mass function (pmf).
The pmf looked like a bunch of spikes, and
probabilities were represented by the heightsof the spikes.
For a continuous random variable, we have a
probability density function (pdf). The pdf looks like a curve, and probabilities
are represented by areas under the curve.
Friday, April 20, 2012 29Dr. S. Jain