Additional comments, problems 1.1, 1.2 and 1.3

The pRisk.xlsm program has a bulit in function for numerical integration. The integrand should be a textstring where the integration variable always is specified by "x". The syntax of the integrand is standard "international" Excel format, i.e., period as the decimal symbol, and comma as the list seperator.

A link to the pRisk.xlsm is found it here. There is also a demonstration file for how to use the NumInt() function which you find here.

For a given set of parameters, i.e., $DD$, $\mu$ and $\sigma$, it is straight forward to type in the integrand and use the NumInt function in pRisk.xlsm.

The relation between the actual $\mu$ and $p$ is $\mu=+mu_0/(1+0.01p)$. For $p=0$ and with the estimates from the data we have $\mu=29.375$ and $\sigma=6.163$. Thus the integrand is:

(x-DD)*PDFNormal(x, 29.375,6.163)

where PDFNormal also is a built in function in pRisk.xlsm. We could therefore type in a cell

=NumInt("(x-DD)*PDFNormal(x, 29.375,6.163)",DD,DD+30)

In order to caclulate the total cost for various $p$ values we calculate corresponding values of $\mu=+mu_0/(1+0.01p)$ and type the numbers into the NumInt() function. This is a tedious task, therefore the solution has shown how we can "create" the text string for the integrand based on the calculated $\mu$. This is not very elegant, and entering programming mode is much more efficient, see the Problem1_1_2_3_VBA.xlsm file.

This problem asks for both doing numerical integration and numerical minimization in the same task. Obvious, this might be time consuming. So if we are able to replace the numerical integration by an analytical expression we are much better off. We may now apply the following relation:

$ B(DD) = \int_{DD}^\infty (x-DD)f_X(x) \,\mathrm{d}x = (\mu-DD)\left({1- \Phi \left[\frac{DD-\mu}{\sigma}\right] }\right)+ \sigma \phi\left(\frac{DD-\mu}{\sigma}\right) $

if $X \sim N(\mu,\sigma^2)$. The "backorder function" B() is implemented in pRisk.xlsm.

If we would like to solve the problem in the Worksheet, we use the Solver. If we would like to program it from scrach, we use the minimization routine described in the "programming tutorial", and the solution is shown in Problem1_1_2_3_VBA.xlsm.