Optimizing poisson distribution for maximum average profit

optimizationpoisson distributionprobabilityprobability distributions

A store offers a new seasonal product featured. Let $N$ be the random variable which means the number of clients who come to the store during the season, where $N∼Poisson(27)$. It is estimated that the probability that a customer buys the new product is $p=0.7167$ regardless from a customer to another.

X: The number of customers who purchase the product ;

Y: The number of customers who do not buy the product.

Each unit sold generates a profit of 20\$, and each unit that hasn't been sold by the end of the season costs 8\$ to store until the next season.

What is the number of units n should the store have at the start of the season to maximize average profits?

My answer: I found that X,Y are independent Poisson-distributed random variables :

$X∼Poisson(27p)$

$Y∼Poisson(27(1-p))$.

I found the loss function to be :

$L(X,n) =$ \begin{array}{rcl}
20(X-n) & \mbox{for}
& X>n \\ 8(n-X) & \mbox{for} & X\leq n
\end{array}

I know I want to find $\frac{d}{dn}E[L(X,n)]=0$ to minimize average loss and by doing so maximize average profit.
However I am not sure if this is the right method to take, or on how to proceed from here.

Any help is appreciated

Best Answer

The difficulty in your approach lies is that to solve $\frac{d}{dn}E[L(X,n)]=0$ you most likely have to calculate the closed form of the sum that is $E[L(X,n)]$. If you can not find such a closed form, then you should instead look at the difference $E[L(X,n+1)] - E[L(X,n)]$.

The probability that $x$ customers buy the product can be seen as a 2 stage experiment, with the first stage selecting how many customers come to the store, and the second stage selecting how many of these customers buy the product. Therefore we have: $$ \mathbb{P}(X=x) = \sum_{n=0}^\infty \mathcal P_{27}(\{n\})\mathcal B_{n,0.7167}(\{x\}) $$ Let $\lambda :=27, p:=0.7167$. Then we have: $$\begin{align} \mathbb{P}(X=x) &= \sum_{n=0}^\infty e^{-λ}·\frac{λ^n}{n!}·\binom{n}{x}·p^x·(1 - p)^{n - x} \\ &= \frac{e^{-λ}·p^x·(1 - p)^{-x}}{x!}·\sum_{n=0}^\infty \frac{λ^n·(1 - p)^n}{(n - x)!} \\ &= \frac{e^{-λ}·p^x·(1 - p)^{-x}}{x!}·\lambda^x (1-p)^x\sum_{n=0}^\infty \frac{λ^{n-x}·(1 - p)^{n-x}}{(n - x)!} \\ &= \frac{e^{-λ}·p^x·(1 - p)^{-x}}{x!}·\lambda^x (1-p)^x\sum_{n=-x}^\infty \frac{λ^{n}·(1 - p)^{n}}{(n )!} \\ &= \frac{e^{-λ}·p^x·(1 - p)^{-x}}{x!}·\lambda^x (1-p)^x\sum_{n=0}^\infty \frac{λ^{n}·(1 - p)^{n}}{(n )!} \\ &= \frac{e^{-λ}·p^x·(1 - p)^{-x}}{x!}·\lambda^x (1-p)^x e^{\lambda (1-p)} \\ &= \frac{e^{-\lambda p}·(p\lambda)^x·}{x!} \\ &= \mathcal P_{\lambda p}(\{x\}) \end{align}$$

Let $n$ be the amount of the product we have in store. If we say that every sold product gives us a value of $20$, and every unsold product costs us $8$, then we have the following expected profit (Let $P(n)$ be the expected profit if we have an amount of $n$ of the product in store):

$$ P(n):=\sum_{x=0}^\infty \mathbb P (X=x) (20\min(x,n)-8\max(n-x,0))\\ = \sum_{x=0}^n \mathbb P (X=x) (20x-8(n-x)) + \sum_{x=n+1}^\infty \mathbb P (X=x) 20n \\ = \sum_{x=0}^\infty \mathbb P (X=x) 20n + \sum_{x=0}^n \mathbb P (X=x) \left(20(x-n)-8(n-x)\right) \\ = 20n + \sum_{x=0}^n \mathbb P (X=x) \left(20(x-n)-8(n-x)\right) \\ = 20n + \sum_{x=0}^n \mathbb P (X=x) 28(x-n) $$

To calculate the $n$ for which $P(n)$ is maximal, we now look at $P(n+1)-P(n)$:

$$\begin{align} P(n+1)-P(n) &= 20 + \sum_{x=0}^{n+1} \mathbb P (X=x) 28(x-(n+1)) - \sum_{x=0}^n \mathbb P (X=x) 28(x-n) \\ &= 20+ \sum_{x=0}^{n} \mathbb P (X=x) 28(x-(n+1)) - \sum_{x=0}^n \mathbb P (X=x) 28(x-n) \\ &= 20+ \sum_{x=0}^{n} \mathbb P (X=x) \big(28(x-(n+1))-28(x-n)\big) \\ &= 20 -28\sum_{x=0}^{n} \mathbb P (X=x) \end{align}$$

Since $\sum_{x=0}^{n} \mathbb P (X=x) $ is monotonically increasing towards 1, we find out that profit first increases, eventually reaches a maximum, and then forever decreases.

Therefore, the biggest integer below $n$ for which the equality $$P(n+1)-P(n) =0 \quad\Leftrightarrow\quad 20 -28\sum_{x=0}^{n} \mathbb P (X=x) =0 \quad\Leftrightarrow\quad \sum_{x=0}^{n} \mathbb P (X=x) = \frac{20}{28} $$ holds is the maximum.

Since $\sum_{x=0}^{n} \mathbb P (X=x) $ is the cumulative distribution function for $\mathcal P_{\lambda p}(\{x\})$, we can look up the point where $\sum_{x=0}^{n} \mathcal P_{\lambda p}(\{x\})=\frac{20}{28}$ in a table.

From there we obtain $n\approx 21.22229747$.

Addendum: I haven't used that $X$ and $Y$ are stochastically independent. If one uses this fact in a clever manner, one can probably shorten the above calculation drastically.

Related Question