Random variables, expectation, and variance
[Pages:31]Random variables, expectation, and variance
DSE 210
Random variables
Roll a die.
Define = X
1 if die is 3 0 otherwise
Here the sample space is = {1, 2, 3, 4, 5, 6}.
Roll dice. n
! = 1, 2 ) X = 0 ! = 3, 4, 5, 6 ) X = 1
= # of 6's X
= # of 1's before the first 6 Y
Both and are defined on the same sample space, XY
= {1, 2, 3, 4, 5, 6}n. For instance,
! = (1, 1, 1, . . . , 1, 6) ) = 1, = 1. X Yn
In general, a
is a defined on a probability space.
random variable (r.v.)
It is a mapping from to R. We'll use capital letters for r.v.'s.
The distribution of a random variable
Roll a die. Define = 1 if die is 3, otherwise = 0.
X
X
takes values in {0, 1} and has distribution: X
Pr(X = 0)
=
1 3
and
Pr(X = 1)
=
2 3.
Roll dice. Define = number of 6's.
n
X
takes values in X
{0,
1,
2,
.
.
.
,
}. n
The
distribution
of
X
is:
Pr( = ) = #(sequences with 6's) ? Pr(one such sequence)
Xk
k
=n
1 k 5 nk 66
k
Throw a dart at a dartboard of radius 1. Let be the distance to the X
center of the board.
takes values in [0, 1]. The distribution of is:
X
X
Pr( ) = 2. Xx x
Expected value, or mean
The expected value of a random variable is X
X E(X ) = x Pr(X = x).
x
Roll a die. Let be the number observed. X
E(X )
=
1
?
1 6
+
2
?
1 6
+
?
?
?
+
6
?
1 6
=
1+2
+
3+4 6
+
5+6
=
3.5
(average)
Biased coin. A coin has heads probability . Let be 1 if heads, 0 if tails. pX
E(X ) = 1 ? p + 0 ? (1
) p
=
p.
Toss a coin with bias repeatedly, until it comes up heads. p
Let be the number of tosses. X
E(X )
=
1 .
p
Pascal's wager
Pascal:
I
think
there
is
some
chance
( p
> 0)
that
God
exists.
Therefore
I
should act as if he exists.
Let = my level of suering. X
I Suppose I behave as if God exists (that is, I behave myself).
Then is some significant but finite amount, like 100 or 1000. X
I Suppose I behave as if God doesn't exists (I do whatever I want to).
If indeed God doesn't exist: = 0. X
But if God exists: X = 1 (hell).
Therefore, E(X ) = 0 ? (1
) p
+
1
?
p
=
1.
The first option is much better!
Linearity of expectation
I If you double a set of numbers, how is the average aected? It is also doubled.
I If you increase a set of numbers by 1, how much does the average change?
It also increases by 1.
I
Rule:
E(aX
+
) b
=
aE(X )
+
b
for
any
random
variable
X
and any
constants , . ab
I But here's a more surprising (and very powerful) property:
E(X
+
Y
)
=
E(X )
+
E(Y )
for
any
two
random
variables
, X
. Y
I
Likewise:
E(X + Y
+
) Z
=
E(X )
+
E(Y
)
+
E(Z ),
etc.
Linearity: examples
Roll 2 dice and let Z denote the sum. What is E(Z )?
Method 1 Distribution of :
Z
2 3 4 5 6 7 8 9 10 11 12
z
Pr( = ) Zz
1 36
2 36
3 36
4 36
5 36
6 36
5 36
4 36
3 36
2 36
1 36
Now use formula for expected value:
E(Z )
=
2
?
1 36
+
3
?
2 36
+
4
?
3 36
+
?
?
?
=
7.
Method 2 Let X1 be the first die and X2 the second die. Each of them is a single die and thus (as we saw earlier) has expected value 3.5. Since Z = X1 + X2,
E(Z ) = E(X1) + E(X2) = 3.5 + 3.5 = 7.
Toss
n
coins
of
bias
, p
and
let
X
be
the
number
of
heads.
What
is
E(X )?
Let
the
individual
coins
be
X1,
.
.
.,
. Xn
Each has value 0 or 1 and has expected value .
p
Since
X
=
X1
+ X2
+???
+, Xn
E(X
)
=
E(X1)
+
?
?
?
+
E(Xn)
=
. np
Roll a die n times, and let X be the number of 6's. What is E(X )?
Let X1 be 1 if the first roll is a 6, and 0 otherwise.
E(X1)
=
1 6.
Likewise,
define
X2,
X3,
.
.
.
,
. Xn
Since
X
=
X1
+???
+, Xn
we
have
E(X )
=
E(X1) +
? ? ? + E(Xn)
=
n 6
.
Coupon collector, again
Each cereal box has one of action figures. What is the expected k
number of boxes you need to buy in order to collect all the figures?
Suppose you've already collected 1 of the figures. Let be the time
i
Xi
to collect the next one.
Each box you buy will contain a new figure with probability
( k
( i
1))/k. Therefore,
E(Xi ) = k + 1 . ki
Total
number
of
boxes
bought
is
X
=
X1
+ X2
+???
+, Xk
so
E(X ) = E(X1) + E(X2) + ? ? ? + E(Xk )
= =
k k k
+
1
k
k
+
1 2
1+ k
+???
k +
2 1
+
?
?
?
+
k 1
ln . kk
k
Independent random variables
Random variables X , Y are independent if
Pr(X
=
x, Y
=
) y
=
Pr(X
=
x )Pr(Y
= ). y
Independent or not?
I Pick a card out of a standard deck. = suit and = number.
X
Y
Independent.
I Flip a fair coin times. = # heads and = last toss.
n
X
Y
Not independent.
I , take values { 1, 0, 1}, with the following probabilities: XY
Y -1 0 1 -1 0.4 0.16 0.24 0 0.05 0.02 0.03 X 1 0.05 0.02 0.03
Independent.
XY -1 0.8 0.5 0 0.1 0.2 1 0.1 0.3
Variance
If you had to summarize the entire distribution of a r.v. by a single X
number, you would use the mean (or median). Call it ?.
But these don't capture the
of :
spread X
Pr(x)
Pr(x)
x ?
x ?
What would be a good measure of spread? How about the average distance away from the mean: E(|X ?|)?
For convenience, take the square instead of the absolute value.
Variance:
var( ) X
=
E(X
?)2 = E(X 2)
?2,
where ? = E(X ). The variance is always 0.
Variance: example
Recall:
var( X
)
=
E(X
?)2 = E(X 2)
?2, where ? = E(X ).
Toss
a
coin
of
bias
. p
Let
X
2
{0, 1}
be
the
outcome.
E(X ) = p
E(X 2) = p
E(X
?)2 = 2 ? (1 p
) + (1 p
)2 ? = (1 p pp
) p
E(X 2)
?2 = p
2 = (1 pp
) p
This variance is highest when p = 1/2 (fair coin).
p
The standard deviation of is var( ).
X
X
It is the average amount by which diers from its mean.
X
Variance of a sum
var(X1
+???+ ) Xk
=
var(X1
)
+
?
?
?
+
var( Xk
)
if
the
Xi
are
independent.
Symmetric random walk. A drunken man sets out from a bar. At each time step, he either moves one step to the right or one step to the left, with equal probabilities. Roughly where is he after steps?
n
Let 2 { Xi
1, 1}
be
his
th i
step.
Then
E(Xi )
=
?0
and
var( ) Xi
=
?1.
His
position
after
n
steps
is
X
=
X1
+
???
+
. Xn
E(X ) = 0 var( ) =
X np stddev( ) =
Xn
He is likely to be pretty close to where he started!
Sampling
Useful variance rules:
I
var(X1
+
?
?
?
+
Xk
)
=
var(X1)
+
?
?
?
+
var( Xk
)
if
's Xi
independent.
I var( + ) = 2var( ). aX b a X
What fraction of San Diegans like sushi? Call it . p
Pick people at random and ask them. Each answers 1 (likes) or 0 n
(doesn't
like).
Call
these
values
X1,
.
.
.
,
. Xn
Your
estimate
is
then:
=
X1
+
???+ Xn .
Y
n
How accurate is this estimate?
Each has mean and variance (1 ), so
Xi
p
pp
E(Y ) = E(X1) + ? ? ? + E(Xn) = p
n
var( ) Y
=
var(X1)
+???
2
+ var( ) Xn
=
(1 p
) p
r
n
n
stddev( ) = Y
(1 p
) p
2p1
n
n
DSE 210: Probability and statistics
Winter 2018
Worksheet 4 -- Random variable, expectation, and variance
1. A die is thrown twice. Let X1 and X2 denote the outcomes, and define random variable X to be the minimum of X1 and X2. Determine the distribution of X.
2. A fair die is rolled repeatedly until a six is seen. What is the expected number of rolls?
3. On any given day, the probability it will be sunny is 0.8, the probability you will have a nice dinner is 0.25, and the probability that you will get to bed early is 0.5. Assume these three events are independent. What is the expected number of days before all three of them happen together?
4. An elevator operates in a building with 10 floors. One day, n people get into the elevator, and each of them chooses to go to a floor selected uniformly at random from 1 to 10.
(a) What is the probability that exactly one person gets out at the ith floor? Give your answer in terms of n.
(b) What is the expected number of floors in which exactly one person gets out? Hint: let Xi be 1 if exactly one person gets out on floor i, and 0 otherwise. Then use linearity of expectation.
5. You throw m balls into n bins, each independently at random. Let X be the number of balls that end up in bin 1.
(a) Let Xi be the event that the ith ball falls in bin 1. Write X as a function of the Xi. (b) What is the expected value of X?
6. There is a dormitory with n beds for n students. One night the power goes out, and because it is dark, each student gets into a bed chosen uniformly at random. What is the expected number of students who end up in their own bed?
7. In each of the following cases, say whether X and Y are independent.
(a) You randomly permute (1, 2, . . . , n). X is the number in the first position and Y is the number in the second position.
(b) You randomly pick a sentence out of Hamlet. X is the first word in the sentence and Y is the second word.
(c) You randomly pick a card from a pack of 52 cards. X is 1 if the card is a nine, and is 0 otherwise. Y is 1 if the card is a heart, and is 0 otherwise.
(d) You randomly deal a ten-card hand from a pack of 52 cards. X is 1 if the hand contains a nine, and is 0 otherwise. Y is 1 if all cards in the hand are hearts, and is 0 otherwise.
8. A die has six sides that come up with dierent probabilities:
Pr(1) = Pr(2) = Pr(3) = Pr(4) = 1/8, Pr(5) = Pr(6) = 1/4.
(a) You roll the die; let Z be the outcome. What is E(Z) and var(Z)?
4-1
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- commonly used distributions
- random variables distributions and expected value
- tips and techniques for using the random number generators
- appendix b random numbers table and instructions
- x ap statistics solutions to packet 7
- ti nspire summary statistics
- unit 5 random number generation and variation generation
- random variables expectation and variance
- random numbers cpp
- chapter 3 pseudo random numbers generators
Related searches
- random trivia questions and answers
- mean variance and standard deviation calculator
- standard deviation and variance relationship
- standard deviation and variance definition
- discrete random variables calculator
- variance of random variable calculator
- variance discrete random variable calculator
- standard deviation and variance formula
- variance of random variable
- random hand swelling and itching
- scientific variables worksheet and answers
- distribution and variance calculator