Download Lecture 6 - ece.unm.edu

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
ECE 340
Lecture 6: Random variable
Jean Liu
Email: [email protected]
Reading
• This class: Section 3.1, 3.2,3.3
• Next class: Section 3.3, 3.4
Outline
• Random variable
– Definition
– Notation
• Probability mass function (pmf)
• Expected value
• Samples
Random experiment
• Temperature in ABQ on Feb.
• Length of queue at a movie theater
• The number of words in your emails
• The color of a car in the street
• The side of coin tossed N time
• The mood of me today
An assignment of a value (number) to every
possible outcome
Mathematically: A function from the sample
space to the real numbers
Sample space
ζ
∞
-∞
Sx
– discrete or continuous
Can have several random variables defined
on the same sample space
Sample space
ζ
∞
-∞
Sx
∞
-∞
S’x
• Notation:
• – random variable X ,Y
• – numerical possible value x ,y,
• X(ζ)=x, Y(ζ)=y,
Example 1
• A coin tossed 3 times. The sequence of heads
and tails are noted.
• Let X be number of heads
ζ
HHH HHT
HTH
THH HTT
THT
TTH
TTT
X(ζ)
3
2
2
1
1
0
2
1
Example 1
• A coin tossed 3 times. The sequence of heads and tails
are noted.
• Let X be number of tails
• Other functions?
ζ
HHH HHT
HTH
THH HTT
THT
TTH
TTT
X(ζ)
0
1
1
2
2
3
1
2
Example 1
• A coin tossed 3 times. The sequence of heads and tails are
noted.
• Let X be number of heads
• Let Y be rewords{$8 for 3 Heads,$1 for 2 heads;$0 for others}
ζ
HHH HHT
HTH
THH HTT
THT
TTH
TTT
X(ζ)
3
2
2
2
1
1
1
0
Y(ζ)
8
1
1
1
0
0
0
0
ζ
X(ζ)
HHH HHT
3
2
HTH
2
THH
2
HTT
1
THT
1
TTH
1
TTT
0
Y(ζ)
8
1
1
0
0
0
0
1
P[Y=1]=P[X=2] =P[{HHT,HTH,THH}]=3/8
P[Y=8] =P[X=3]=P[HHH]=1/8
S
A
B
P[X ∈ B]
Discrete random variable
• A X is defined as a random variable that
assumes values from a countable set.
• SX ={ x1, x2, x3,…}
Probability mass function
p X ( x) = P[ X = x] = P[{ζ : X (ζ ) = x}]
A3
A1
A2
…
Ak
x1
p X ( x1 ) = P[ A1 ];
x2
xk
p X ( x2 ) = P[ A2 ];
Probability mass function
(I )
( II )
p X ( x) ≥ 0
∑p
x∈Sx
( III )
X
for all x
( x) = 1
P[ X in B] = ∑ p X ( x)
x∈B
Example 2
•
•
•
•
Toss a six-side dice
Outcomes: {1,2,3,4,5,6}
X is the number of the side.
Sx: {1,2,3,4,5,6}
pX{x}
pX{1}; pX{2};… pX{6};
pX{1}= pX{2}=… =pX{6}=1/6
pX{1}+ pX{2}+… +pX{6}=1
Relative
frequencies
pmf
1/6
1/6
1 2 3 4 5
6
Uniform random variable
1 2 3 4
5
6
Bernoulli random variable
Success or failure experiment
⎧0
I (ζ ) = ⎨
⎩1
if ζ failure ⎫
⎬
if ζ success ⎭
pI (0) = 1 − ρ
pI (1) = ρ
pmf
p
1
1-p
0
Geometric random variable
• Let X be the number of times a message needs to be
transmitted until it arrives correctly.
pX (k) = P[ X = k] = P[000...1] = (1− ρ) ⋅ ρ,
k −1
k = 1,2...
1
0.8
0.6
0.4
0.2
0
1
2
3
4
5
6
7
8
9
10
Expected value (mean)
• Definition:
E[ X ] =
∑ x⋅ p
x∈S X
X
( x) = ∑ xk ⋅ p X ( xk )
k
• Interpretation
– Center of gravity
– Average in a large number of repetitions (infinite)
Uniform random variable
• Toss a fair dice
E[ X ] = ∑ xk p( xk )
k
1
1
1
1
1
1
= 1⋅ + 2 ⋅ + 3 ⋅ + 4 ⋅ + 5 ⋅ + 6 ⋅
6
6
6
6
6
6
pmf
= 3.5
1/6
1 2 3 4 5
6
Bernoulli random variable
pI (0) = 1 − ρ
pI (1) = ρ
E[ I ] = 0 ⋅ p (0) + 1⋅ p (1) = ρ
pmf
p
1
1-p
0
Geometric random variable
pX (k ) = (1− ρ)k −1 ⋅ ρ,
∞
k = 1,2...
E( X ) = ∑k ⋅ (1− ρ) ⋅ ρ
k −1
k =1
∞
= ρ ⋅ ∑k ⋅ (1− ρ)k −1
k =1
=
0.2
1
0.15
ρ
0.1
0.05
0
0
2
4
6
8
10
Sample mean vs. Expected value
x (1) + x (2) + x (3) + .... + x ( n )
X n =
N
x N (1) + x 2 N (2) + x 3 N (3) + .... + x n N ( n ) + ...
= 1
N
= x1 f1 ( n ) + x 2 f 2 ( n ) + ... + x n f n ( n ) + ...
=
∑x
k
fk (n)
k
Lim f k ( n ) = p x ( x k )
n→∞
E[ X ] =
∑x
k
k
⋅ p X ( xk )
Example 3
A betting game: toss a coin three times
Pay
$1.5
Rewards $1, if 2 heads
$8, if 3 heads
$0, others
Expected reward ?
Expected gain ?
Expected value of functions
of a random variable
X is discrete random variable.
Z=g(X);
E[Z] = E[g(X)] = Σ g(x) ·pX(xk)
• X is a noise voltage that is uniformly
distributed in Sx{-3, -1, 1,3} with p(xk)=1/4.
• Z= X2
Pmf of Z: pz(1)=1/2
pz(9)=1/2
E[Z]=1·1/2+ 9·1/2=5
E[z]=Σx2p(xk)= 9·1/4+ 1·1/4+ 1·1/4+ 9·1/4=5
• X is random variable
• Z= a·g(X) + β·h(X) +c
E[Z]=a·E[g(x)] + β·E[h(x)] + c
E[a·X]=a·E[X]
E[g(x) + h(x)]= E[g(x)]+E[h(x)]
E[g(x) + c]= E[g(x)] + c