Written by: Marcus Zusak Main Characters Ed Kennedy Audrey Marv Ritchie Awards
Expectations 1 Krishna.V.Palem Kenneth and Audrey Kennedy Professor of Computing Department of...
-
Upload
martin-fields -
Category
Documents
-
view
219 -
download
0
Transcript of Expectations 1 Krishna.V.Palem Kenneth and Audrey Kennedy Professor of Computing Department of...
Expectations
1
Krishna.V.PalemKenneth and Audrey Kennedy Professor of ComputingDepartment of Computer Science, Rice University
ContentsDiscussion of tutorial solutionsExpectations & In-class exerciseSum of Expectations In-class exerciseProject Discussion
2
Discussion of tutorial solutions
3
ContentsDiscussion of tutorial solutionsExpectations & In-class exerciseSum of Expectations In-class exerciseProject Discussion
4
In-class exercise -1
5
Let us change gears and move to a new topicConsider the following exercise
Divide yourselves into teams of 2 and each person (A & B) gets equal number of chips, say 30
Each group will be given a coin to tossIf you get a head, person A gets 2 chips from person BIf you get a tail, person B gets 2 chips from person A
After 20 rounds, how many more chips do you think each of you will earn (i.e. number of extra chips than the given 30 chips)?
Let us test it out for ourselves.
6
Maintain the record of your game in the following way
Toss OutcomeNumber of chips each player has
1
2
3
4
5
.
.
.
19
20
Observe these numbers
Can you now take a guessof your earnings after 50,100or 1000 turns?
Play this game for 20 rounds
7
Can you now take a guessof your earnings after 50turns, 100 turns, 1000 turns ?
Answering this question is very important to get an idea of how much you are going to earn.
Let us use probability
First let us calculate the earnings each player can expect in one turn
i p
HEAD=0 ½
TAIL=1 ½
So a player has ½ chance of earning 2 chips
He has ½ chance of losing 2 chips
So we can expect to earn (½ * 2)- (½ * 2) = 0 more chip at the end of every turn on an average
Very important
8
Let us see another example
This time we will consider another randomizing device – our friendly die
Earnings
Outcome
Earning
1 3
2 3
3 2
4 2
5 1
6 1
Throw OutcomeNumber of chips till
that point
1
2
3
4
5
6
7
8
9
10
Maintain a similar record till 20 throws in the following format
9
We again visit the same question.Can you now take a guessof your earnings after 20turns, 50 turns, 100 turns ?
This time we know that the probability function of a die can be represented as
i p(i)
1 1/6
2 1/6
3 1/6
4 1/6
5 1/6
6 1/6
There is a 1/6th chance of winning 3 chipsThere is a 1/6th chance of winning 3 chipsThere is a 1/6th chance of winning 2 chipsThere is a 1/6th chance of winning 2 chipThere is a 1/6th chance of winning 1 chipThere is a 1/6th chance of winning 1 chip
On an average we can expect (1/6)*3 + (1/6)*3 + (1/6)*2 + (1/6)*2+ (1/6)*1 + (1/6)*1 = 2 chips every throw
What does this mean ?
10
What do we mean when we say that the earning per game is 2 chips?
To understand this, let us first consider the following question.
Consider an unbiased coin toss.
The probability of obtaining a HEAD = ½
But for n trials of the experiment do we always get n/2 HEADs and n/2 TAILs ?
Consider the following experiment:
Toss a coin 5, 10, 50, 100, 500, 1000 … 10000 times. At each point collect the data regarding number of HEADs and number of TAILs.
Now let us analyze data obtained from one such experiment.
11
What do you observe as the number of trials grows large ?
12
Can you observe that as the number of trials grows “large” the result of the experimenttends to agree with the ideal case ?
13
What do we mean when we say that the earning per game is 2 chips?
That does not seem right!!
To understand this, let us first consider the following question.
Consider an unbiased coin toss.
The probability of obtaining a HEAD = ½
But for n trials of the experiment do we always get n/2 HEADs and n/2 TAILs ?
Consider the following experiment:
Toss a coin 5, 10, 50, 100, 500 … 9999 times. At each point collect the data regarding number of HEADs and number of TAILs.
It means that as the number of trials(n) grows “large” then it can be expected that
the earnings will be equal to 2* n
Conclusion
Expectation
14
Consider the following table
Event
Random
variable (x)
Earning
e(x)
Probability
P(x)
Event 1 x=1 3 1/6
Event 2 x=2 3 1/6
Event 3 x=3 2 1/6
Event 4 x=4 2 1/6
Event 5 x=5 1 1/6
Event 6 x=6 1 1/6
Expected earning OR Average earning per Event (E)
It can be written according to the previous intuition ase(1)*P(1) + e(2)*P(2) + … e(6)*P(6)=(3+3+2+2+1+1)*1/6 = 2
We can also define the earnings for each roll (or event) as a function of the random variable.
So let us calculate the
ExpectationPrecise mathematical definition of expectation
For a given experiment, there is an event space that is defined.
A random variable x is defined which takes a distinct value for each event in the event space.
A function f can be defined on the event space and thus on the random variable x
The expected value of f is defined as
n
i
ixPixfxE1
)()()( Where i is the number of events
In-class exercise 2: Expectation
Using the definition of expectation, solve the following problem
An American roulette wheel has 38 places where the ball may land, all equally likely.
A winning bet on a single number pays 35-to-1, meaning that the original stake is not lost, and 35 times that amount is won, so you receive 36 times what you've bet.
This means that if you bet $1 on a specific one of the 38 places
(i)If you lose, you lose the amount you bet(ii)If you win, you win 35 times the bet amount plus you keep you keep the amount you bet
Question:1.What is the expected amount of money you will be left with after each game? (Assume $1 bets)
A) -$0.0263
ContentsDiscussion of tutorial solutionsExpectations & In-class exerciseSum of Expectations In-class exerciseProject Discussion
17
Expectation of a sum
18
Till now we have been referring to the expectation of a single quantity
Suppose we need to evaluate the expected value of the sum of two dice throws
Consider the following exerciseEach person will get a pair of dice, say die 1 and
die 2The first round
Each player rolls each die separately 20 times and calculates the expected value of each individual dice
The second roundEach player rolls both the dice at once 20 times and
calculates the expected value of the totalSimplifying assumption: Use 1/6th as the
probability for each outcome of the die
Expectation of a sum
19
Let us first try to evaluate mathematically what the expected value of the sum might be.
Recall the basic formula for expectation
The expected value of f is defined as
n
i
ixPixfxE1
)()()( Where i is the number of events
Analysis of data
20
Roll Die 1 outcome
Die 2 outcome
1
2
..
Calculate the expected outcome of each die from the above data
Roll Die 1 + Die 2
1
2
..
Calculate the expected value of the outcome of both the dice together
Let us check if the mathematical derivation is in fact correct
Joint Probability
21
Recall that we studied about joint or composite eventsFor example, a roll of a die is a single event
But roll of two dice simultaneously is a joint or composite event consisting of two simple events
The probability of such an event can be expressed a joint probability function as follows :Consider the roll of two dice where
x : Random variable that denotes the outcome of the first die
y : Random variable that denotes the outcome of the second die
thenProbability that x = i and y=j is denoted as p(x=i,y=j)In fact in this case p(x=i,y=j) = p(x=i) * p(y=j)
Here p(x=i,y=j) is called the joint probability of the two random variables x and y
22
Let us define the following variables
x : Random variable that denotes the outcome of the first diey : Random variable that denotes the outcome of the second diez : Random variable that denotes the outcome of the sum of both the dice
Therefore we can say that z = x+y
Using the formula for calculating expectation of z
zjikzk
jyixpjikzpkyxEzE ),()()()()(
xi yj
jyixpji ),()(
Cover all possible combinations of x and y
23
xi yj
jypixpji )()()(
xi yj
jyixpji ),()( Joint probability in thiscase is the product of the twoprobabilities
xi yj
ixpjypjjypi )())(())((
)()()( ixpjypjjypixi yjyj
)()()( ixpyEjypixi yj
Rearranging some terms
Rearranging some terms
Substitute the formula for expectation with E(Y)
24
)()()( ixpyEjypixi yj
xixi
ixpyEixpi )()()(
xi
ixpyExE )()()(
)()( yExE
)()( ixpyEixi
Sum of probabilities is equal to 1
Expanding the product inside the summation
Substitute formula for expectation of X
Sum of probabilities is equal to 1
)()()()( yExEyxEzE Is a very important result
Lessons Learnt
25
How can you relate the expectations of individual dice and the total ?The expectation of the total is the sum of the individual
expectationsHow do you mathematically prove it ?
Use the formula for expectationBecause it is a linear summation,
But what are the conditions when this statement holds ?This statement holds under all conditions
That means that this law can be applied on any set of random variables
The expectation of a sum is equal to the sum of expectation
Generalizing the result
26
Prove that the expectation of sum of n random variables is equal to the sum of expectation of the n random variables.That is prove the following Let X1, X2, X3…. Xn be n random variablesLet Z = X1 + X2 + X3…. + Xn
To prove:
n
iiXEZE
1
)()(
ContentsDiscussion of tutorial solutionsExpectations & In-class exerciseSum of Expectations In-class exerciseProject Discussion
27
Field Goal Percentage vs. Free Throw PercentageA case study of applied probability on sports
By Yung-Seok Kevin Choi It is advantageous to quantify different aspects of a game to
strategize In basketball two of the primary statistics are
Field Goal Percentage ratio of field goals achieved to field goals attempted
Free Throw Percentage ratio of free throws achieved to free throws attempted
SolutionCollect the data from a basketball reference websiteMATLAB to analyze and parse data
The data was organized into different binsMATLAB to compute conditional probabilities such as
Made statements such as “given a guard’s free throw percentage in bin 6, we are 85 percent
confident that his field goal percentage falls between bins 6 and 11.”
Problem Statement: In basketball, is field goal percentage related to free throw percentage and how does this relationship differ between positions?
Impartiality in MafiaBy Jose Luis Garcia
There is an interactive social game called Mafia The basic idea of the game is that there are two groups (Townspeople and Mafia) with
each having different advantages who attempt to use these strengths in order to incapacitate the rival group and thus win the game.
Is it the case that one of the two groups has more chance of winning than the other Specific Analysis
What is the probability of being assigned to either mafia or townspeople? How many turns on average does it take to finish a game? Is there a group favored to win and if so which group? How is the win/loss probability related to the number of players?
Solution Mathematical model of the game
Define the variables (number of players, win probability etc.) MATLAB script to run multiple trials of the game Based on the ratio of townspeople to the mafia
Define the probability of winning of the townspeople A card is chosen at random from a given stack (MATLAB script) Compute winning and losing probabilities based on multiple trials
One such Conclusion As the number of players is increased the probability of Mafia winning is also
increased.
Problem Statement: Analyze the impartiality of an interactive social game called Mafia
Probability in Currency ExchangeBy Thomas Roinesdal
The values of international currencies fluctuate every day Data about trading between among different currencies is available It will be very advantageous if one can predict the future value of the exchange
rate of a currency based on the historical trends.
Solution Model
Consider pairs of currencies Example: 1 US dollar = 1.4 Singapore dollar
Collect historical data of trends in the exchange rate Compute the relative frequency of different exchange rates Calculate conditional probabilities based on this data by applying Bayes
Theorem Conclusion
Based on historical data of many currency exchange rates, there was less than 30% chance of predicting accurately a future value of a given currency But it was shown that some currencies are more correlated than
others
Problem Statement: Is it possible to predict a currency given the historical values of other currencies?
END
31