返回博客列表

Derivation of Poisson distribution

2019年11月14日
3 min read
编程数学统计学

A model for "Bread supply problem"

Introduction

We need to predict how much bread will be sold the next day, so that the bakery can prepare the right amount and avoid much waste.

In order to give convincible prediction, we should derive the probability of the sale amount. The sale amount obeys a Poisson distribution, and the derivation is as follows.

Derivation

We set T as the store opening time, random variable X as the number of the sold bread. The problem is transformed into: What is the distribution of X?

Since every bread is sold in different time, we divide T into n small enough part Δt, one deal falls in one time period. (if two deals in one period, just cut the period into smaller.)

T=nΔtT=n\cdot \Delta t

For each Δt, the probability that a deal appears is p. Pt(X=k)P_t(X=k) denotes the probability that k breads are sold in time t. Every deal is independent with each other, which fits the Binomial distribution:

PT(X=k)=limn(nk)pk(1p)nkP_T(X=k)=\lim_{n \to \infty} {n \choose k}p^k(1-p)^{n-k}

and XB(n,p)X\sim B(n,p). so:

E(X)=np=μE(X)=np=\mu

and we get p:

p=μnp=\frac{\mu}{n}

substitute p in PT(X=k)P_T(X=k):

PT(X=k)=limn(nk)pk(1p)nkP_T(X=k)=\lim_{n \to \infty} {n \choose k}p^k(1-p)^{n-k}

=limn(nk)(μn)k(1μn)nk=\lim_{n \to \infty} {n \choose k}\left(\frac{\mu}{n}\right)^k\left(1-\frac{\mu}{n}\right)^{n-k}

=limnn(n1)(n2)(nk+1)k!μknk(1μn)nk=\lim_{n \to \infty} \frac{n(n-1)(n-2)\cdots(n-k+1)}{k!}\frac{\mu^k}{n^k}\left(1-\frac{\mu}{n}\right)^{n-k}

=limnnnn1nnk+1nμkk!(1μn)k(1μn)n=\lim_{n \to \infty} \frac{n}{n}\cdot\frac{n-1}{n}\cdots\frac{n-k+1}{n} \frac{\mu^k}{k!}\left(1-\frac{\mu}{n}\right)^{-k}\left(1-\frac{\mu}{n}\right)^{n}

look at these parts:

limnnnn1nnk+1n(1μn)k=1\lim_{n \to \infty} \frac{n}{n}\cdot\frac{n-1}{n}\cdots\frac{n-k+1}{n}\left(1-\frac{\mu}{n}\right)^{-k}=1

limn(1μn)n=eμ\lim_{n \to \infty}\left(1-\frac{\mu}{n}\right)^{n}=e^{-\mu}

so:

PT(X=k)=limn(nk)pk(1p)nk=μkk!eμP_T(X=k)=\lim_{n \to \infty} {n \choose k}p^k(1-p)^{n-k}=\frac{\mu^{k}}{k!}e^{-\mu}

Now the distribution of X is known, it's actually a Poisson distribution, namely, XP(μ)X\sim P(\mu).

An example

There is one question left: How to get μ

In Poisson Distribution, E(X)=μE(X)=\mu, so we can use the mean value of samples to estimate μ. Assume last week, the sold breads are:

DayMonTueWedThuFriSat
Amount70102657798110

μXˉ=87\mu\approx \bar{X}=87.

so the probability:

PT(X=k)=87kk!e87P_T(X=k)=\frac{87^{k}}{k!}e^{-87}

and the corresponding Probability density function image:

in this example, if the bakery prepare 105 breads everyday, the probability that the breads are enough is:

PT(X105)=0.97P_T(X\leq105)=0.97

that means, in most cases enough, but the expectation of waste bread is 105E(X)=18105-E(X)=18. It's a dilemma between waste amount and enough supply. The model can help with the decision.

Some remarks

In practice we should record the sale history data, and do some analysis first and observe:

  • is the sale amount different in different seasons?
  • does the sale amount change in holidays?
  • is the sale amount related to weather?

and so on.

Then use the data of a certain period to estimate the parameter μ, and get corresponding model which works in that period of time.

reference

Mainly from the answer of 马同学(matongxue314)

评论讨论

使用 GitHub 账号登录参与讨论

加载评论中...