14 Discrete Random Variables
Download
Report
Transcript 14 Discrete Random Variables
“Teach A Level Maths”
Statistics 1
Discrete Random
Variables
© Christine Crisp
Discrete Random Variables
Suppose we roll an ordinary 6-sided die sixty
times and record the number of ones, twos, etc.
We might get
Number on die
1
2
3
4
5
6
Frequency
12
9
11
10
7
11
If I asked you what you might expect to happen if
we went on rolling the die you might say that you
would expect roughly the same number of ones,
twos, etc.
In saying this, you would be using a perfectly
reasonable model.
Models in Statistics describe situations and are
used to make predictions.
Discrete Random Variables
We could write the model out as a table:
x
P (X = x)
1
1
6
2
1
6
3
1
6
4
1
6
5
1
6
6
1
6
x gives the value of the number shown on the die.
It is a variable which can be any value from 1 to 6.
We let X be a description of the variable, so:
“ X is the number shown on the face of the die”
We label the 2nd row P (X = x) .
If x = 1, for example, we get P(X = 1) which means
the probability that the number shown on the die is 1.
Discrete Random Variables
So, we have
x
P(X = 1 )
1
1
6
2
1
6
3
1
6
4
1
6
5
1
6
6
1
6
Discrete Random Variables
So, we have
x
P(X = 2 )
1
1
6
2
1
6
3
1
6
4
1
6
5
1
6
6
1
6
Discrete Random Variables
So, we have
x
P(X = 3 )
1
1
6
2
1
6
3
1
6
4
1
6
5
1
6
6
1
6
Discrete Random Variables
So, we have
x
P(X = 4 )
1
1
6
2
1
6
3
1
6
4
1
6
5
1
6
6
1
6
Discrete Random Variables
So, we have
x
P(X = 5 )
1
1
6
2
1
6
3
1
6
4
1
6
5
1
6
6
1
6
Discrete Random Variables
So, we have
x
P(X = 6 )
1
1
6
2
1
6
3
1
6
4
1
6
5
1
6
6
1
6
Discrete Random Variables
So, we have
x
P(X = x )
1
1
6
2
1
6
3
1
6
4
1
6
5
1
6
6
1
6
Discrete Random Variables
So, we have
x
P(X = x )
2
1
6
1
1
6
3
1
6
4
1
6
5
1
6
6
1
6
This table shows the probability distribution of X.
If we add up ( sum ) the probabilities we get 1
is the Greek capital letter S and stands for Sum
6
So we can write
P( X x ) 1
x 1
The sum from 1 to 6 of the probabilities of all
the values of X, ( x = 1, 2, 3, 4, 5, 6 ) equals 1
Discrete Random Variables
A variable where the sum of the probabilities of
all its possible values is equal to 1 is called a
random variable ( r.v. ).
So, in our example, X is the random variable
“ the number shown on the face of the die”
We can usually see what values the random variable
can have, so we don’t need to show them on the
summation sign.
So, we often write
P( X x) 1
X is an example of a discrete random variable. It
takes certain values only.
In the example these values were the integers from
1 to 6. ( In exercises the numbers are often
integers but they don’t have to be. )
Discrete Random Variables
•
•
•
•
SUMMARY
A statistical model uses probabilities to describe a
situation and to make predictions.
A probability distribution gives the probabilities for
a random variable.
A variable where the sum of the probabilities of all
its possible values is equal to 1 is called a random
variable (r.v.). If X takes only certain values in an
interval, X is a discrete random variable.
If X is a discrete random variable, then
N.B.
P( X x) 1
X describes the r.v.
x gives the values of the r.v.
Discrete Random Variables
e.g. 1
Let X be the variable “ the number of sixes
showing when 2 dice are rolled”. Show that X is a
random variable and write its probability
distribution in a table.
Solution: We can have 0 sixes, 1 six or 2 sixes:
Using
a 6that
” we can
6 / forto“not
We want
show
, so we need
P ( write
X x )the
1possibilities
as
6 / , 6 / , 6 / , 6 of
, 6getting
, 6 / , 60, ,6 1 or 2 sixes.
to find the probabilities
5 5 25
6 6 36
5 1
1 5 10
/
/
P ( X 1) P ( 6 , 6 ) P ( 6 , 6 )
6 6
6 6 36
1 1
1
to add
P ( 6be
, 6 ) easier
PTip:
( X It
2 ) will
6 6 36
Then, P ( X 0 ) P ( 6 / , 6 / )
the fractions if we don’t cancel
Discrete Random Variables
1
10
25
P
(
X
2
)
,
P ( X 0)
, P ( X 1)
36
36
36
36
25 10
1
1
So,
P( X x)
36
36 36 36
Since P ( X x ) 1 , X is a random variable.
The probability table is
x
P (X = x)
0
25
36
1
2
10 5 1
3618 36
Discrete Random Variables
1
10
25
P
(
X
2
)
,
P ( X 0)
, P ( X 1)
36
36
36
36
25 10
1
1
So,
P( X x)
36
36 36 36
Since P ( X x ) 1 , X is a random variable.
The probability table is
x
P (X = x)
0
25
36
1
5
18
2
1
36
This is an example of a discrete random variable
because the variable takes only some values in an
interval rather than every value.
Discrete Random Variables
The Mean of a Discrete Random Variable
We can find the mean of a discrete random variable
in a similar way to that used for data.
Suppose we take our first example of rolling a die.
Number on die
1
2
3
4
5
6
Frequency
12
9
11
10
7
11
The mean is given by
But,
f1
,
f2
f f
xf
x1 f 1 x 2 f 2 . . .
x
f
f
1st xbe
-value
1stby
frequency
. . . can
replaced
p1 , p2 . . .
the probabilities of getting 1, 2, . . .
So, the mean x 1 p1 x 2 p 2 . . .
xp
Discrete Random Variables
Notation for the Mean of a Discrete Random Variable
When dealing with a model, we use the letter m
for the mean (the greek letter m).
pronounced “mew”
We write
m xp
or, more often, replacing p by P ( X x ) ,
m xP ( X x )
Instead of m, we can also write E(X).
This notation comes from the idea of the mean
being the Expected value of the r.v. X.
Discrete Random Variables
Notation for the Mean of a Discrete Random Variable
When dealing with a model, we use the letter m
for the mean (the greek letter m).
pronounced “mew”
We write
m xp
or, more often, replacing p by P ( X x ) ,
m xP ( X x )
Instead of m, we can also write E(X).
This notation comes from the idea of the mean
being the Expected value of the r.v. X.
( Think of this as being what we expect to get on
average ).
Discrete Random Variables
e.g. 1. A random variable X has the probability
distribution
x
1
5
10
1
1
p
P (X = x) 4
2
Find (a) the value of p and (b) the mean of X.
Solution: (a) Since X is a discrete r.v.,
p1
p 14
(b) mean, m xP ( X x ) 1 14 5 12 10 14
1
4
P( X x) 1
1
2
21
4
Tip: Always check that your value of the mean lies
within the range of the given values of x. Here, 21
4 or
5·25, does lie between 1 and 10.
Discrete Random Variables
The probabilities in a probability distribution can
sometimes be given by a formula.
The formula is called a probability density function
( p.d.f. ).
e.g. 1. Write out a probability distribution table
for the r.v. X where
x
P( X x)
6
Solution:
x
P (X = x)
1
1
6
x 1, 2, 3
for
2
2
6
1
3
3
3
6
1
2
Discrete Random Variables
The probabilities in a probability distribution can
sometimes be given by a formula.
The formula is called a probability density function
( p.d.f. ).
e.g. 1. Write out a probability distribution table
for the r.v. X where
x
P( X x)
6
Solution:
x
P (X = x)
1
1
6
for
2
1
3
x 1, 2, 3
3
1
2
These probabilities can be shown on a diagram.
Discrete Random Variables
x
P (X = x)
1
1
6
2
1
3
3
1
2
P( X x)
This is called a
stick diagram.
1
2
1
3
1
6
x
1
2
3
Discrete Random Variables
e.g. 2. Find the value of the constant k for the
random variable X with p.d.f. given by
P ( X x ) kx
for
x 1, 2, 3, 4
Solution:
Since X is a discrete random variable,
So,
P( X x) 1
1k 2 k 3 k 4 k 1
10k 1
k 01
Discrete Random Variables
SUMMARY
•
The mean, m , of a discrete random variable is
given by
m xP ( X x )
•
•
The mean is also referred to as the expectation
or expected value of the r.v.
m can be written as E(X)
•
The probabilities can be given by a formula called
the probability density function ( p.d.f. )
•
An unknown constant in the p.d.f. can be found
by using
P( X x) 1
Discrete Random Variables
Exercise
1. The tables show the probability distributions of 2
random variables. For each, find (i) the value of p
(ii) the mean value.
(b)
(a)
x
P (X = x)
1
1
6
2
1
3
x
3
0
P (X = x) 0 3
p
1
2
p
0 6
2. Write out the probability distribution for the
random variable, X, where the probability distribution
function is
x
P( X x)
for x 1, 2, 3, 4
10
Discrete Random Variables
Solution:
1(a)
X is a random variable:
x
P (X = x)
mean,
(b)
m
1
1
6
2
1
3
3
p
P( X x) 1
1 1
1
p1 p
6 3
2
1
1
1
xP ( X x ) m 1 2 3
6
3
2
14 7
6 3
x
0
P (X = x) 0 3
1
2
p
0 6
03 p 06 1
p 01
mean, m 0 0 3 1 0 1 2 0 6 1 3
Discrete Random Variables
2. Write out the probability distribution for the
random variable, X, where the probability distribution
function is
Solution:
x
P( X x)
10
for
x 1, 2, 3, 4
x
1
2
3
P(X = x )
1
10
21
10 5
3
10
4
42
10 5
Discrete Random Variables
2. Write out the probability distribution for the
random variable, X, where the probability distribution
function is
Solution:
x
P( X x)
10
for
x 1, 2, 3, 4
x
1
2
3
4
P(X = x )
1
10
1
5
3
10
2
5
Discrete Random Variables
Exercise
3. Find the exact value of the constant k for the
random variable X with p.d.f. given by
k
P( X x)
x
Solution:
for
x 1, 2, 3
Since X is a discrete random variable,
P( X x) 1
So,
k k k
1
1 2 3
6k 3k 2k
1
6
11k
1
6
6
k
11
Discrete Random Variables
Variance of a Discrete Random Variable
The variance of a discrete random variable is found
in a similar way to the one we used for the mean.
For a frequency distribution, the formula is
2
x
f
2
2
variance s
x
f
x f1 x f 2 . . .
x2
f
2
Replacing
f1
2
by p1 etc. gives
f
s x 1 p1 x 2 p 2 . . . x 2
2
2
2
Discrete Random Variables
s 2 x 1 p1 x 2 p 2 . . . x 2
2
2
But we must replace x by m and we replace s by
the letter ( which is the Greek lowercase s,
pronounced sigma ).
So,
2 x 2 p1 x 2 p 2 . . . m 2
2 x 2 P( X x) m 2
( Notice that this expression contains the Greek
capital S, S, and the lowercase s, . )
The variance of X is also written as Var(X).
Discrete Random Variables
e.g. 1 Find the variance of X for the following:
x
1
2
3
4
P(X = x )
1
10
2
10
3
10
4
10
Solution:
2 x 2 P( X x) m 2
We first need to find the mean, m : m xP ( X x )
30
1
2
3
4
3
m 1
2
3
4
10
10
10
10 10
2 x 2 P( X x) m 2
1
2
3
4
2
2
2
1
2
3
4 ( 3) 2
10
10
10
10
Tip: With a1 bit8of 27
practice
64 you’ll find
100 you can simplify
9 quicker
1
without
calculator.
9
the fractions
a
It’s
and
10
10 10 10
10
more accurate. Try these before you see my answer.
2
2
Discrete Random Variables
•
SUMMARY
The mean of a discrete random variable is given
by
E( X ) m xP ( X x )
•
The variance, , of a discrete random variable is
given by
2
Var ( X ) 2 x 2 P ( X x ) m 2
N.B.
For frequency distributions use x and s 2 for the
mean and variance ( the “English” alphabet ).
For probability distributions ( models )
use m and 2 ( the Greek alphabet ).
Discrete Random Variables
Exercise
1. Find the variance of X for each of the following:
(b)
(a)
x
P (X = x)
1
1
6
Solution: (a)
2
2
2
6
x
3
3
6
0
1
2
P (X = x) 0 3 0 1 0 6
m xP ( X x )
7
1
2
3
14
7
1 2 3
6
6
6
63
3
2
1
2
3
7
x 2 P ( X x ) m 2 12 2 2 3 2
6
6
6
3
1 8 27
49
49 5
6
6 6 6
9
9 9
Discrete Random Variables
Exercise
(b)
x
0
1
2
P (X = x) 0 3 0 1 0 6
Solution:
m xP ( X x )
1 0 1 2 0 6 1 3
2 x 2 P( X x) m 2
12 0 1 2 2 0 6 1 3 2
2 5 1 69
0 81
Discrete Random Variables
The following slides contain repeats of
information on earlier slides, shown without
colour, so that they can be printed and
photocopied.
For most purposes the slides can be printed
as “Handouts” with up to 6 slides per sheet.
Discrete Random Variables
•
•
•
•
SUMMARY
A statistical model uses probabilities to describe a
situation and to make predictions.
A probability distribution gives the probabilities for
a model.
A variable where the sum of the probabilities of all
its possible values is equal to 1 is called a random
variable (r.v.). If X takes only certain values in an
interval, X is a discrete r.v.
If X is a discrete random variable ( r.v. ), then
N.B.
P( X x) 1
X describes the r.v.
x gives the values of the r.v.
Discrete Random Variables
The Mean of a Discrete Random Variable
We can find the mean of a discrete random variable
in a similar way to that for data.
Suppose we take our first example of rolling a die.
Number on die
1
2
3
4
5
6
Frequency
12
9
11
10
7
11
The mean is given by
But,
f1
,
f2
f f
xf
x1 f 1 x 2 f 2 . . .
x
f
f
. . . can be replaced by p1 , p2 . . .
the probabilities of getting 1, 2, . . .
So, the mean x 1 p1 x 2 p 2 . . .
px
Discrete Random Variables
Notation for the Mean of a discrete Random Variable
When dealing with a discrete random variable, we use
the letter m ( pronounced mew ) for the mean (the
greek letter m).
We write
m xp
or, more often, replacing p by P ( X x ) ,
m xP ( X x )
Instead of m, we can also write E(X).
The notation comes from the idea of the mean being
the Expected value of the r.v. X.
( Think of this as being what we expect to get on
average ).
Discrete Random Variables
e.g. 1
Let X be the variable “ the number of sixes
showing when 2 dice are rolled”. Show that X is a
random variable and write its probability
distribution in a table.
Solution: We can have 0 sixes, 1 six or 2 sixes:
Using 6 / for “ not a 6 “ we can write the possibilities
as
6 / , 6 / , 6 / , 6 , 6, 6 / , 6, 6
5 5 25
6 6 36
5 1
1 5 10
/
/
P ( X 1) P ( 6 , 6 ) P ( 6 , 6 )
6 6
6 6 36
1 1
1
P ( X 2 ) P ( 6, 6 )
6 6 36
Then, P ( X 0 ) P ( 6 / , 6 / )
Discrete Random Variables
1
10
25
P
(
X
2
)
,
P ( X 0)
, P ( X 1)
36
36
36
36
25 10
1
1
So,
P( X x)
36
36 36 36
The probability table is
x
P (X = x)
0
25
36
1
5
18
2
1
36
Discrete Random Variables
SUMMARY
•
The mean, m , of a discrete random variable is
given by
m xP ( X x )
•
•
•
The mean is also referred to as the expectation
or expected value of the r.v.
m can be written as E(X)
The probabilities can be given by a formula called
the probability density function ( p.d.f. )
Discrete Random Variables
Variance of a Discrete Random Variable
For a frequency distribution, the formula is
variance s
Replacing
f1
f
2
f
fx 2
x2
f1 x 2 f 2 x 2 . . .
x2
f
by p1 etc. gives
s p1 x 1 p 2 x 2 . . . x 2
2
2
2
But for a random variable, we must replace x by m
and we replace s by the letter (the greek s,
pronounced sigma ). So,
2 p1 x 2 p 2 x 2 . . . m 2
2 x 2 P( X x) m 2
The variance of X is also written as Var(X).
Discrete Random Variables
e.g. 1 Find the variance of X for the following:
x
1
2
3
4
P(X = x )
1
10
2
10
3
10
4
10
2 x 2 P( X x) m 2
Solution:
xP ( X x )
We first need to find the mean, m : m
30
1
2
3
4
3
m 1
2
3
4
10
10
10
10 10
2 x 2 P( X x) m 2
1
2
3
4
2
2
2
1
2
3
4 ( 3) 2
10
10
10
10
1
8 27
64
100
91
9
10
10 10 10
10
2
2
Discrete Random Variables
SUMMARY
•
The mean, m , of a discrete random variable is
given by
E( X ) m xP ( X x )
•
The variance, , of a discrete random variable is
given by
2
Var ( X ) 2 x 2 P ( X x ) m 2
N.B.
For frequency distributions use x and s 2 for the
mean and variance ( the “English” alphabet ).
For probability distributions ( models )
use m and 2 ( the Greek alphabet ).