Docsity

Monte Carlo Simulation Poisson Processes - Discrete Math Model | MATH 381, Study notes of Mathematics

Partial preview of the text

Download Monte Carlo Simulation Poisson Processes - Discrete Math Model | MATH 381 and more Study notes Mathematics in PDF only on Docsity!

Monte Carlo Simulation

Poisson processes

Tim Chartier

Department of Mathematics @

Math 381

On or off in the fish store

Last time we assumed that each day 1 or 0 customers could enter the fish store. We implemented this strategy in MATLAB with the following code:

randomNumber = rand; if randomNumber < a customer = 1; else customer = 0; end

What about if 2 or more customers arrive in one day? at random times? This surely could happen even with an average of one customer per week.

Making things probable

Remember what we did last time, we had that an average of 1 sale per week. This led to a 1/7 probability of a sale on any given day. If we had an average of 2 sales per week. Then, we could assume a probability of 2/7 for a sale on any given day. If we had an average of 8 sales per week, then what? Assuming a probability of 8/7 for a sale on any given day won’t work. But, we could assume with probability of 4/7 that there is a sale on any given half of a day.

Pause and reflect

Note that shrunk the time unit to “form” a probability. Goal: Given a = the average number of customers per day. Find pk = the probability of exactly k customers arriving on a given day. Note that if we had such probabilities the MATLAB code to capture this in arrivals at the store easily follows:

random_num = rand(1); if random_num < p customers = 0; elseif random_num < p0+p customers = 1; elseif random_num < p0+p1+p customers = 2; else customers = 3; end

Now what?

Run the experiment on several days and find the percentage of times that you have 2 customers per day. This gives an estimate to p 2. For example, let us split our day into 5 intervals. Then, two customers arrived on the following day. 0 1 0 1 0 and also on this day: 1 0 1 0 0 On the course web page, poisson.m performs such experiments.

Is it done yet?

Remember, we need to run enough days to gain accurate results. Let’s run our experiment for over 27 years.

That is, let’s run our simulation for a simulated 10,000 days.

Analytical Development

These probabilities can be computed without simulation as they follow a Poisson distribution. In fact, probability of exactly k customers in a single day is:

pk =

ak^ e − a k!

Therefore,

p 0 = e − a^ ≈ 0. 3679 p 1 = ae − a p 2 = a^2 e − a / 2

Download poisson2.m from the course web page to compare the computed probabilities with the actual.

To the infinite and beyond

The Poisson distribution is continuous. How is our finite process leading to this continuous distribution. The arrival of customers is being modeled using a Poisson process. As we saw before, we can split our day into units and test if 1 or 0 customers arrive in that unit of time. For instance, let us take 3 such intervals. When we test if a customer arrives or not, we are taking a Bernoulli trial. Therefore, we have the following:

Unit 1 Unit 2 Unit 3

where there is a probability p of a customer arriving in interval i.

Summing up

Adding up the probabilities, we find p ( k^3 ), the probability of observing k customers when N = 3:

0 customers ( 1 − p )^3 = p ( 03 ) 1 customers 3 ( 1 − p )^2 p = p ( 13 ) 2 customers 3 ( 1 − p ) p^2 = p ( 3 ) 2 3 customers p^3 = p 3 (^3 ) Note that these probabilities sum to 1. We can see this easily using the fact that

( x + y )^3 = x^3 + 3 x^2 y + 3 xy^2 + y^3

with x = 1 − p and y = p.

Summing up

The binomial expansion leads to p ( kN )since

( x + y ) N^ = xN^ +

( N 1

) xN −^1 y +

( N 2

) xN −^2 y^2 +· · ·+

( N N − 1

) xyN −^1 + yN^.

The values

N

k

(“ N choose k ”) — the binomial coefficients.

The probabilities we seek are

p ( 0 N ) = ( 1 − p ) N p ( 1 N ) =

N

( 1 − p ) N −^1 p = N ( 1 − p ) N −^1 p

p ( 2 N ) =

N

( 1 − p ) N −^2 p^2 = 12 ( N^2 − N )( 1 − p ) N −^2 p^2 .. .

This is called the binomial distribution for the total number of “successes” in N Bernoulli trials.

Homework prep

Let us go over the next homework assignment. Problem 3: Finding your Perfect Mate in Monte Carlo

Develop a dating strategy to find a spouse and use Monte Carlo simulation to optimize the implementation of the strategy.

A mathematical love life

There are several rules and assumptions to our dating game. You may date only one person at a time. While the length of time that you date someone is not specified, you must eventually “pass” on a dating partner and move to another candidate or “select” a dating partner as a mate at which time the strategy ends and you have a spouse. Once a dating partner is passed, you cannot date that person again. That is, no is forever! If you knew the N potential mates in advance and ranked them according to their “fit” where a ranking of 1 indicates the best fit, 2 indicates the second best fit and so forth, there would be no ties. Therefore, among the pool of N people to date, one person is the best match for you. While we will assume there are N people in the pool for you to date, you will know the number of people in the pool but do not know who these people are in advance and will meet them one at a time as you date. Therefore, you will only know all N people if you date all N. The order in which you date the N people is random.