# Discrete Mathematical Modeling\\ {\bf Homework 10

Author

Jens Luebeck et. al.

License

Creative Commons CC BY 4.0

Abstract

Homework 9

Share your thoughts on the Overleaf Template Gallery!

Author

Jens Luebeck et. al.

License

Creative Commons CC BY 4.0

Abstract

Homework 9

```
\documentclass[11pt,letterpaper]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[margin=1in]{geometry}
\usepackage{wrapfig}
\usepackage[justification=centering]{caption}
\usepackage[subnum]{cases}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1em}
\usepackage{empheq}
\title{Discrete Mathematical Modeling\\ {\bf Homework 10}}
\author{Jens Luebeck, Edward Rusu, Thomas Yu}
\date{3 December 2014}
\begin{document}
\maketitle
\section*{Exercise 8.1}
Reconsider the inventory problem of Example 8.1, but now suppose that the store policy is to order more aquariums if there are less than two left in stock at the end of the week. In either case (zero or one remaining) the store orders enough to bring the total number of aquariums in stock back up to three.
\subsection*{a) Exceeding Supply}
We calculate the probability that the demand rate for aquariums in a given week exceeds the supply.
\subsubsection*{Step 1}
We list our variables and assumptions below. Here, we are not given the distribution, so we assume it is a Poisson distribution.
\begin{minipage}{0.5\textwidth}
$S_n$: Supply of aquarium at week $n$. \\
$D_n$: Demand for aquarium at week $n$.
\end{minipage}
\begin{minipage}{0.5\textwidth}
If $S_{n-1} - D_{n-1} > 1$, then $S_n = S_{n-1} - D_{n-1}$. \\
If $S_{n-1} - D_{n-1} \leq 1$, then $S_n = 3$. \\
$Pr\{D_n = k\} = e^{-1}/k!$.
\end{minipage}
\subsubsection*{Step 2}
We will model this problem as a Markov chain in steady state.
\newpage
\subsubsection*{Step 3}
\begin{wrapfigure}[14]{r}{0.5\textwidth}
\includegraphics[width = 0.48\textwidth]{Hw10_fig1.png}
\caption{\label{aq:state:fig} State transition diagram.}
\end{wrapfigure}
Let $X_n = S_n$. The state space is $X_n \in \{2,3\}$. We tabulate the following transitions:
\begin{tabular}{ c c l }
$X_n =2$ & $X_{n+1}$ = 2 & if $D_n = 0$ \\
& $X_{n+1}$ = 3 & if $D_n > 0$ \\
$X_n = 3$ & $X_{n+1} = 2$ & if $D_n = 1$ \\
& $X_{n+1} = 3$ & if $D_n = 0$ or $D_n > 1$
\end{tabular}
The distribution of the demand variable $D_n$ gives the following values
\begin{align*}
Pr\{D_n = 0\} & = 0.3679 \\
Pr\{D_n = 1\} & = 0.3679 \\
Pr\{D_n > 1\} & = 0.2642
\end{align*}
Thus, we have the following matrix of probabilities
\begin{align} \label{aq:P}
P & =
\begin{pmatrix}
p_{11} & p_{12} \\
p_{21} & p_{22}
\end{pmatrix} \notag \\
P & =
\begin{pmatrix}
0.3679 & 0.6321 \\
0.3679 & 0.6321
\end{pmatrix}
\end{align}
\subsubsection*{Step 4}
Since $\{X_n\}$ is an ergodic Markov chain, we can compute a unique steady state probability vector $\vec{\pi}$. We solve
\begin{align*}
\vec{\pi} = \vec{\pi} P
\end{align*}
along with $\pi_1 + \pi_2 = 1$.
\begin{align*}
\pi_1 = 0.3679\pi_1 + 0.3679\pi_2 \\
\pi_2 = 0.6321\pi_1 + 0.6321\pi_2 \\
\pi_1 + \pi_2 = 1
\end{align*}
The solution to this system is
\begin{equation} \label{aq:steady}
\begin{aligned}
\pi_1 = 0.3679 \\
\pi_2 = 0.6321
\end{aligned}
\end{equation}
That is, for large $n$, it is approximately true that
\begin{align*}
Pr\{X_n = 2\} = 0.3679 \\
Pr\{X_n = 3\} = 0.6321
\end{align*}
We use this information to find when the demand exceeds the supply
\begin{align} \label{aq:ans}
Pr\{D_n > S_n\} & = \sum_{i=2}^{3} Pr\{D_n > S_n | X_n = i\} Pr\{X_n = i\} \notag \\
& = (0.08)(0.3679) + (0.019)(0.6321) \notag \\
Pr\{D_n > S_n\} & = 0.0414
\end{align}
\subsubsection*{Step 5}
Example 8.1 presented us with an inventory policy that the aquarium stock should only be refilled if there are no aquariums left in stock. This resulted in 10\% sales loss. By changing the inventory policy, the sales loss is reduced to 4.14\%, half of what it was before.
\subsection*{b) Sensitivity to Demand Rate}
Suppose now that $Pr\{D_n = k\} = e^{-\lambda}/k!$. We wish to perform a sensitivity analysis on $\lambda$. The distribution of the demand variable now becomes
\begin{align*}
Pr\{D_n = 0\} & = e^{-\lambda} \\
Pr\{D_n = 1\} & = e^{-\lambda} \\
Pr\{D_n > 1\} & = 1-2e^{-\lambda}
\end{align*}
so that the matrix \eqref{aq:P} becomes
\begin{align} \label{aq:sense:P}
P & =
\begin{pmatrix}
e^{-\lambda} & 1-e^{-\lambda} \\
e^{-\lambda} & 1-e^{-\lambda}
\end{pmatrix}
\end{align}
We have tabulated several important results below and Figure \eqref{aq:sens:fig} is a graphical display of the probability that demand exceeds supply given different $\lambda$'s.
\begin{center}
\begin{tabular}{c | c | c}
$\lambda$ & Steady State $\vec{\pi}$ & $Pr\{D_n > S_n\}$ \\
\hline
0.75 & $(0.4724, 0.5276)$ & 4.78\% \\
0.9 & $(0.4066 0.5934)$ & 4.36\% \\
1.0 & $(0.3679, 0.6321)$ & 4.14\% \\
1.1 & $(0.3329, 0.6671)$ & 3.93\% \\
1.25 & $(0.2865, 0.7135)$ & 3.65\%
\end{tabular}
\end{center}
\begin{figure}[h]
\includegraphics[width = \textwidth]{Hw10_fig2.png}
\caption{\label{aq:sens:fig} Sensitivity of the probability of lost sales to the arrival rate.}
\end{figure}
\subsection*{c) Estimating $S(p,\lambda)$}
Let $p$ denote the steady-state probability that demand exceeds supply. The sensitivity of $p$ to $\lambda$ is just the slope of the line in Figure \eqref{aq:sens:fig}. We have
\begin{align*}
S(p,\lambda) & = \frac{\Delta p}{\Delta \lambda} \\
S(p,\lambda) & = \frac{-0.0113}{0.5} \\
S(P,\lambda) & = -0.0226 \\
\end{align*}
Thus we estimate that the sensitivity of the probability of lost sales to arrival rate is
\begin{align*}
S(p,\lambda) = -0.0226
\end{align*}
\section*{Exercise 8.5}
\subsection*{a) Steady-state distribution of the market state}
We have a Markov process with three states.
$M_1 = $ Bear market \\
$M_2 = $ Strong bull market \\
$M_3 = $ Weak bull market
Furthermore, assume the transition matrix is represented by $P$, where
\begin{align*}
P =
\begin{pmatrix}
0.9 & 0.02 & 0.08 \\
0.05 & 0.85 & 0.1 \\
0.05 & 0.05 & 0.9
\end{pmatrix}
\end{align*}
represents the weekly dynamics in the stock market.
Since $\{M_n\}$ is an ergodic Markov chain, we can compute a unique steady state probability vector $\vec{\pi}$. We solve
\begin{align*}
\vec{\pi} = \vec{\pi} P
\end{align*}
along with $\pi_1 + \pi_2 + \pi_3= 1$, where $\pi_i$ corresponds to $M_i$.
\begin{align*}
\pi_1 = 0.90\pi_1 + 0.05\pi_2 + 0.05\pi_3 \\
\pi_2 = 0.02\pi_1 + 0.85\pi_2 + 0.05\pi_3 \\
\pi_3 = 0.08\pi_1 + 0.1\pi_2 + 0.90\pi_3 \\
\pi_1 + \pi_2 + \pi_3 = 1
\end{align*}
The solution to this system is
\begin{equation} \label{stock:steady}
\begin{aligned}
\pi_1 = 0.3333,
\pi_2 = 0.2,
\pi_3 = 0.4667
\end{aligned}
\end{equation}
For large $n$, it is also approximately true that
\begin{align*}
P\{M_1\} = 0.3333,
P\{M_2\} = 0.2,
P\{M_3\} = 0.4667
\end{align*}
In other words, we expect to be in a Bear market 33\% of the time, a strong bull market 20\% of the time, and a weak bull market 47\% of the time.
\subsection*{b) Yield on \$10,000 investment}
Suppose we invest \$10,000 in a mutual fund for ten years. Each year this fund yields a return $R(i)$ of -3\%, 28\%, and 10\% annually when the stock market is in state $M_1$, $M_2$, and $M_3$ respectively. We wish to determine our expected yield for ten years.
First, we assume that the transition matrix $P$ and the returns $R$ are unchanging for 10 years. Additionally, assume that we don't touch the fund for 10 years; any money that we gain stays in the fund, and if we loose money, we don't withdraw the fund.
Since there are $n = 52$ weeks in a year, we have $n$ large enough so that we can use the approximation from Equation \eqref{stock:steady}. Then, we have the following discrete dynamical system
\begin{align*}
Y_{n+1} = Y_n + Y_n \Bigg( \sum_{i=1}^3 Pr\{X_n = i\} R(i) \Bigg)
\end{align*}
where $Y_n$ is how much money we have in the firm.
Since $P$ and $R$ don't change over time, the summation returns a constant 0.092667, so we can reduce this equation to
\begin{align} \label{stock:dynamics}
Y_{n+1} & = 1.092667 Y_n
\end{align}
We solve this system and tabulate the results below.
\begin{center}
\begin{tabular}{c | c}
$n$ & $Y_n$ \\
\hline
0 & \$10,000 \\
1 & \$10,926.67 \\
2 & \$11,939.21\\
3 & \$13,045.58 \\
4 & \$14,254.48 \\
5 & \$15,575.40 \\
6 & \$17,018.72 \\
7 & \$18,595.80 \\
8 & \$20,319.01 \\
9 & \$22,201.92 \\
10 & \$24,259.30 \\
\end{tabular}
\end{center}
{\bf Therefore, after ten years we expect the fund to return \$14,259.30}.
Lastly the order of the state transitions doesn't make a difference. As the weeks go on, the transitions will reach steady-state; we have sufficiently large enough $n$ that we will jump through many states in concordance with the steady state distribution.
\subsection*{c) Worst-Case scenario}
In the worst-case scenario, $R(i)$ is 40\%, 20\%, and 40\% for $M_1$, $M_2$, and $M_3$, respectively. Equation \eqref{stock:dynamics} then becomes
\begin{align*}
Y_{n+1} = 1.084Y_n
\end{align*}
Integrating this system returns a yield of \$12,402.31 after 10 years. This is \$1856.99 less than part (b). Because the stock market spends more time in the bear market state, the -3\% gain has a greater effect on the overall return.
\subsection*{d) Best-Case Scenario}
In the best-case scenario, $R(i)$ is 10\%, 70\%, and 20\% for $M_1$, $M_2$, and $M_3$, respectively. Equation \eqref{stock:dynamics} then becomes
\begin{align*}
Y_{n+1} = 1.213Y_n
\end{align*}
Integrating this system returns a yield of \$58,961.71 after 10 years. This is \$44,702.41 more than part (b). Because the stock market spends more time in the strong bull state, the 28\% gain has a greater effect on the overall return.
\subsection*{e) Mo' Money Market, Mo' Problems}
Consider a money market fund that returns about 8\%. This would yield the following discrete dynamical system
\begin{align*}
Y_{n+1} = 1.08Y_n
\end{align*}
Integrating over ten years with the same assumptions as above yields a return of \$11,589.25. But this is \$813.06 less than the worst-case scenario from the mutual fund. We assume that the reported worst-case distribution is actually the worst case, which is historically untrue. \underline{With our assumption}
\underline{the mutual fund is a better investment opportunity than the money market fund.}
\newpage
\section*{Appendix}
\subsection*{Appendix 1}
\begin{verbatim}
\end{verbatim}
\subsection*{Appendix 2}
\begin{verbatim}
(*problem 8.5*)
(*part A analytical solution*)
soln = Solve[{pi[1] == 0.90*pi[1] + 0.05*pi[2] + 0.05*pi[3],
pi[2] == 0.02*pi[1] + 0.85*pi[2] + 0.05*pi[3],
pi[3] == .08*pi[1] + .1*pi[2] + .90*pi[3],
pi[1] + pi[2] + pi[3] == 1}]
(*A Simulation approach for part A*)
P = {{0.9, 0.02, 0.08}, {0.05, .85, .10}, {0.05, 0.05, 0.90}}
pi[0] = {{1, 0, 0}}
n = 25000; i = 0; Do[{pi[i + 1] = pi[i].P; i = i + 1;}, {n}]
Print[pi[n]]
\end{verbatim}
\end{document}
```