<p>$\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\E}{\mathbb{E}}
%short command for inseting abbreviated "such that" in a math environment
\newcommand{\st}{\text{ s.t. }}
%text in a math environment "as"
\newcommand{\as}{\text{ as }}
%various referencing commands
\newcommand{\rref}[1]{(\ref{#1})}
\newcommand{\eref}[1]{eq. (\ref{#1})}
\newcommand{\fref}[1]{Figure \ref{#1}}
%differential d
\newcommand{\dd}{\, \mathrm{d}}
%variance and covariance$</p>

<h1>Part 1</h1>

<p>Yes. However, it is useful to simplify the answer even further and to write
optimal consumption in terms of other. more easily observed quantities.
Here's the derivation. I also solve for the portfolio holdings. </p>

<p><strong>Calculating Optimal Consumption in terms of Wealth</strong> </p>

<p>Start again with some preliminary calculations related to the budget constraint.
\begin{align*}
\mathbb E_t \left [\pi_T^{\frac{\gamma - 1}{\gamma}} \right ] 
  &amp;= \mathbb E_0 \pi_t^{\frac{\gamma-1}{\gamma}} \exp \left \{
  - \frac{\gamma - 1}{\gamma} \left (r + \frac 12 \eta^2 \right ) (T-t)
  - \frac{\gamma - 1}{\gamma} \eta (B(T) - B(t)) \right \} \\
  &amp;= \pi_t^{\frac{\gamma-1}{\gamma}} \exp \left \{ - \frac{\gamma - 1}{\gamma} (r + \frac 12 \eta^2 ) (T-t) 
  + \frac 12 \frac{(\gamma - 1)^2}{\gamma^2} \eta^2 (T-t) \right \} \\
  &amp;= \pi_t^{\frac{\gamma-1}{\gamma}} \exp \left \{ (T-t) \frac{\gamma - 1}{\gamma} \left[ - r + \frac 12 \eta^2 
  \frac{1}{\gamma} \right] \right \}.
\end{align*}
From the budget constraint
\begin{align*}
\pi_t W_t &amp;= \E_t \left[\int_t^\infty \pi_s C_s \dd s\right] \\
W_t &amp;= \frac{1}{\pi_t} \E_t\left[\int_t^\infty \lambda^{-1/\gamma} e^{-\frac{\rho}{\gamma} s} \pi_s^{\frac{\gamma-1}{\gamma}} \dd s\right] \\
  &amp;= \frac{1}{\pi_t} \int_t^\infty \lambda^{-1/\gamma} e^{-\frac{\rho}{\gamma} s} \E_t\left[\pi_s^{\frac{\gamma-1}{\gamma}} \right] \dd s \\
  &amp;= \frac{1}{\pi_t} \int_t^\infty \lambda^{-1/\gamma} e^{-\frac{\rho}{\gamma} s} \pi_t^{\frac{\gamma-1}{\gamma}} \exp\{-(s-t) \frac{\gamma-1}{\gamma} \left[r + \frac 12 \eta^2 \frac 1 \gamma \right]\} \dd s \\
  &amp;= \pi^{\frac{-1}{\gamma}} \lambda^{\frac{-1}{\gamma}} 
  \int_t^\infty \exp\left\{ -\frac{\rho}{\gamma} (s-t) - \frac{\rho}{\gamma} t - (s-t) \frac{\gamma-1}{\gamma} \left[r + \frac 12 \eta^2 \frac 1 \gamma \right]\right\} \dd s\\
  &amp;= \pi^{\frac{-1}{\gamma}} \lambda^{\frac{-1}{\gamma}} 
  e^{-\frac \rho \gamma t} \int_t^\infty \exp\left\{ - (s-t) \frac{\gamma-1}{\gamma} \left[r + \frac{\rho}{\gamma-1} + \frac 12 \eta^2 \frac 1 \gamma \right]\right\} \dd s \\
  &amp;= \pi^{\frac{-1}{\gamma}} \lambda^{\frac{-1}{\gamma}} 
  e^{-\frac \rho \gamma t} \frac 1 a,
\end{align*}
where 
$a = 
\frac{\gamma-1}{\gamma} \left[r + \frac{\rho}{\gamma-1} + \frac 12 \eta^2 \frac 1 \gamma\right]$
(this is the same as defined in attempt demonstrated in the question).
From our derivation of optimal consumption, we have
$$
C_t^* = \lambda^{-\frac 1 \gamma }e^{-\frac \rho \gamma t} \pi_t^{-\frac 1 \gamma} = a W_t.
$$</p>

<p><strong>Deriving the dynamics for optimal consumption: $\dd C_t^*$.</strong></p>

<p>To proceed to find the optimal portfolio to support this level of consumption, we need to compute the dynamics of $C_t^*$.</p>

<p>We will show that, from our derivation of optimal consumption, 
\begin{equation}
\dd W_t = \frac 1 a \dd C_t^* =
\frac 1 a C_t \frac 1 \gamma \left( \eta \dd Z_t + \frac 12 \frac{1+\gamma}{\gamma} \eta^2 \dd t\right). \label{wealth-dynamics-from-optimal-consumption}
\tag 1
\end{equation}</p>

<p>The second equality is derived as follows.</p>

<p>That second equality comes from $\lambda^{-\frac 1 \gamma} = \frac {w a} r$ (derived in the attempt given in the question statement) and
from Ito's lemma applied to
\begin{align*}
C^*_t &amp;=  \lambda^{-\frac 1 \gamma }e^{-\frac \rho \gamma t} \pi_t^{-\frac 1 \gamma} \\
  &amp;=  \frac {w a}{r}  (e^{\rho t} \pi_t)^{-\frac 1 \gamma} \\
&amp;=  \frac {w a}{r}  \xi_t^{-\frac 1 \gamma}.
\end{align*}
Here I have added the simplifying assumption that $\rho = r$ and I have used the definition that
$\pi_t = e^{-r t} \xi_t$.
The calculation of Ito's lemma on optimal consumption proceeds like this:
\begin{align*}
\dd C_t &amp;= - \frac {wa}{r} \frac 1 \gamma \xi_t^{\frac{-1 - \gamma}{\gamma}} \dd \xi_t
+ \frac 12 \frac{wa}{r} \frac 1 \gamma \frac{1 + \gamma}{\gamma} \xi_t^{- \frac 1 \gamma - 2} (\dd \xi_t)^2 \\
  &amp;= - C_t \frac 1 \gamma \left( \frac{\dd \xi_t}{\xi_t} \right) 
+ \frac 12 C_t \frac 1 \gamma \frac{1+\gamma}{\gamma} \left( \frac{\dd \xi_t}{\xi_t}\right)^2 \\
  &amp;= -C_t \frac 1 \gamma (-\eta \dd B_t) + \frac 12 C_t \frac 1 \gamma \frac{1+\gamma}{\gamma} ( \eta^2 \dd t)
\end{align*}
Thus,
$$
\frac{ \dd C_t}{C_t} = \frac 1 \gamma \left( \frac 12 \eta^2 \frac{1+\gamma}\gamma \dd t + \eta \dd B_t \right).
$$</p>

<p><strong>Match terms to derive optimal portfolio.</strong></p>

<p>We can deduce the optimal portfolio be deriving the dynamics of
a portfolio with a trading strategy defined by the weight $\omega_t$
and comparing these dynamics to the dynamics of wealth implied by
the dynamics we calculated for
optimal consumption.</p>

<p>If $\omega$ is the fraction of wealth we invest in the risky security
and $1-\omega$ is the fraction invested in the riskless security,
then the dynamics for wealth can be written
$$
\dd W_t = \omega (\mu -r) W_t \dd t + (r W_t - C_t) \dd t + W_t \omega \sigma \dd Z_t.
$$</p>

<p>Now, we can derive an expression for $\omega$ by matching the terms
of this equation with the terms of equation (\ref{wealth-dynamics-from-optimal-consumption}).
From the terms on $\dd Z_t$,
\begin{align*}
W_t \omega \sigma &amp;= \frac 1 a C_t \frac 1 \gamma \eta \\
\omega &amp;= \frac \eta {\sigma \gamma}.
\end{align*}</p>

<h1>Part 2</h1>

<p>It seems like consumption is stochastic because consumption here <em>is</em> stochastic. 
Consumption
depends on the state of the economy. It is, however,
$\mathcal F_t$-measurable, so optimal consumption at time $t$
depends only on information available at time $t$. 
Because of the positive Sharpe ratio $\eta$ and finite risk aversion, the agent will invest in the risky security. As we showed previously, consumption
is a fraction of wealth, $C_t^* = a W_t$. Wealth depends on the performance
of the agent's investments. In good times, the agent consumes more.
The fraction of wealth consumed, $a$, depends on
the interest rate $r$, subjective discounting $\rho$, risk aversion
$\gamma$, and the market price of risk (Sharpe ratio) $\eta$.</p>

<h1>Part 3</h1>

<p>One way this can occur is if we assume that the agent can only invest
in the riskless security. Just as well, let $\eta = 0$. Also,
suppose that the interest rate is equal to the subjective discount rate, $r = \rho$. </p>

<p>Doing this, we see that $\pi_t = \exp\{-r t\}$. Also, from
the budget constraint we know that wealth is
$$
W_t = B_t + \theta_t S_t + \E_t \frac{1}{\pi_t} \int_t^\infty \pi_s w \dd s = B_t + \theta_t S_t + \frac w r,
$$
where $B_t$ is the amount on money invested in the riskless asset, $\theta_t$
is the dollar amount invested in the risky security $S_t$, and the remaining
term is the expected discounted present value of future wages (the expectation
here could have been left out since $\pi_s$ and $w$ are constant in this case, 
but I've included
it for consistency).
Also, since $\eta = 0$, $a = r$. Thus,
$$
C_t^* = r W_t = r \left( B_t + \frac w r\right).
$$
Since $B_0 = 0$ by assumption, $C_0 = w$. Loosely speaking, an induction-like
argument gives us that $B_t = 0$ for all $t$ and, thus,
$$
C_t^* = \frac w r = w.
$$</p>

CC BY-SA 3.0
2017-07-12T16:45:58.743Z
2017-08-08T02:32:30.843Z
2017-08-08T02:32:30.843Z
jmbejara
<h1>My Questions</h1>

<p>Consider the following problem. It is almost identical to
the classic Merton portfolio choice problem. Here I'm solving it using
the so-called Martingale method. I have provided my attempt at
a derivation. I have three questions:</p>

<ol>
<li>Is this correct? </li>
<li>Why does it seem like the consumption path is stochastic? I understand that we can
perhaps interpret this problem as identical to the classic Merton
problem where the agent has some starting wealth $W_0 &gt; 0$.
We can do this by saying that $W_0 = \int_0^\infty \pi_t w dt$.
However, why would the agent simple not choose $C_t = w$? 
My suspicion is that this depends on the relative values of $\rho$
and the interest rate $r$. </li>
<li>Under
what conditions would $C_t = w$, if ever?</li>
</ol>

<h1>Problem setup</h1>

<p>An agent has initial wealth $W_0 = 0$ but receives a constant
stream of wages $w$. There is a riskless asset that pays the interest rate 
$r$ and a risky security that follows the dynamics
$$
\frac{dS}{S} = \mu_S dt + \sigma_S dB_t,
$$
where $B_t$ is a standard brownian motion.</p>

<p>Now, the agent has CRRA utility. Thus, his decision is modelled by
the following program:</p>

<p>\begin{align*}
\max_{\{C_t\}_{t=0}^\infty} \quad \mathbb E\left[\int_0^\infty e^{-\rho t} 
  \left ( \frac{C_t^{1-\gamma}}{1 - \gamma} \right )
  \, \mathrm d t \right ] \\
\text{ s.t. } \mathbb E \left [ \int_0^\infty \pi_t (c_t - w) dt \right ] \leq W_0,
\end{align*}
where $\pi_t$ is the stochastic discount factor, which can
be written as
$$
\frac{d \pi_t}{\pi_t} = - \mu_{\pi} dt - \sigma_{\pi} d B_t.
$$</p>

<h1>My solution attempt</h1>

<p>Proceeding with the Martingale method, the first-order condition on the
appropriate Lagrangian are
$$
u_c(c_t, t) = e^{-\rho t} C_t^{-\gamma} = \lambda \pi_t,
$$
where $\pi = e^{-r t} \xi_t$, $\lambda$ is the Lagrange multiplier,
and the exponential martingale is 
$\xi_t = \exp\left (-\eta B_t - \frac{t}{2} \eta^2 \right )$.
Note that this is based on the assumption of complete markets and
is equivalent to
$$
\frac{d \pi_t}{\pi_t} = - r dt - \eta d B_t,
$$
where $\eta = \frac{\mu_s - r}{\sigma_s}$ is the market price of risk.</p>

<p>The first-order condition implies that 
$C^*_t = \left( \lambda \pi_t e^{\rho t} \right )^{-1/\gamma}$.
We can then substitute this into the budget constraint and
solve for $\lambda$:
\begin{align*}
W_0 &amp;= \mathbb E \int_0^\infty \pi_t (C_t^* - w) \, \mathrm d t \\
0  &amp;= \mathbb E \int_0^\infty \pi_t^{\frac{\gamma - 1}{\gamma}} 
      \lambda ^{\frac{-1}{\gamma}} \exp(-\rho t/\gamma) - \pi_t w \, \mathrm d t.
\end{align*}</p>

<p>Now, in order to proceed, let us make the following intermediate calculations:
\begin{align*}
\mathbb E_0[\pi_t] &amp;= \exp\{-r t\} \\
&amp;\text{and} \\
\mathbb E_0 \left [\pi_t^{\frac{\gamma - 1}{\gamma}} \right ] 
  &amp;= \mathbb E_0 \exp \left \{
  - \frac{\gamma - 1}{\gamma} \left (r + \frac 12 \eta^2 \right ) t 
  - \frac{\gamma - 1}{\gamma} \eta B(t) \right \} \\
  &amp;= \exp \left \{ - \frac{\gamma - 1}{\gamma} (r + \frac 12 \eta^2 ) t 
  + \frac 12 \frac{(\gamma - 1)^2}{\gamma^2} \eta^2 t \right \} \\
  &amp;= \exp \left \{ -t \frac{\gamma - 1}{\gamma} \left[ r + \frac 12 \eta^2 
  \frac{1}{\gamma} \right] \right \}.
\end{align*}
Because of the appropriate regularity conditions, we can exchange
the order of integration to 
make the following calculations:
\begin{align*}
\mathbb E \int_0^\infty \pi_t w \, \mathrm d t &amp;= w \int_0^\infty \mathbb E[\pi_t] \, \mathrm d t
  = w \int_0^\infty \exp(-r t) = \frac{w}{r} \\
 \text{and} \\
\mathbb E \int_0^\infty \pi_t^{\frac{\gamma - 1}{\gamma}} 
  \exp \left (\frac{-\rho t}{\gamma} \right ) \, \mathrm d t
  &amp;= \int_0^\infty \exp(-a t) dt = a^{-1},
\end{align*}
where $a = \frac{\rho}{\gamma} +\frac{\gamma - 1}{\gamma}
  \left[r + \frac 12 \eta^2 \frac{1}{\gamma} \right ] $.
Then, continuing with the budget constraint, we
can solve for $\lambda^{-1/\gamma}$,
$$
\lambda^{-1/\gamma} = \frac{w a}{r}.
$$
We can then substitute this back into our expression for
the optimal path of consumption,
$$
C^*_t = \frac{w a}{r} \pi_t^{-1/\gamma} \exp \left \{ -\frac{1}{\gamma} \rho t
  \right \}.
$$</p>

CC BY-SA 3.0
2015-02-15T17:41:30.020Z
I haven't looked at the derivation in detail, but I think martingale approach assumes complete markets, so that the agent can trade also his labor income stream just like any other asset (and presumably he would have to in order to support the derived consumption process). To derive optimal policy for nontraded labor income would probably require to solve agent's dynamic program explicitly.
ivansml
<finance><financial-economics><academic-graduate><continuous-time><portfolio-theory>
Optimal consumption in Merton-like portfolio choice model with constant wage
jmbejara
# Optimal consumption in Merton-like portfolio choice model with constant wage

(Asked by: username_0 on 2015-02-15)

# My Questions

Consider the following problem. It is almost identical to
the classic Merton portfolio choice problem. Here I'm solving it using
the so-called Martingale method. I have provided my attempt at
a derivation. I have three questions:

1. Is this correct?
2. Why does it seem like the consumption path is stochastic? I understand that we can
   perhaps interpret this problem as identical to the classic Merton
   problem where the agent has some starting wealth $W\_0 > 0$.
   We can do this by saying that $W\_0 = \int\_0^\infty \pi\_t w dt$.
   However, why would the agent simple not choose $C\_t = w$?
   My suspicion is that this depends on the relative values of $\rho$
   and the interest rate $r$.
3. Under
   what conditions would $C\_t = w$, if ever?

# Problem setup

An agent has initial wealth $W\_0 = 0$ but receives a constant
stream of wages $w$. There is a riskless asset that pays the interest rate
$r$ and a risky security that follows the dynamics
$$
\frac{dS}{S} = \mu\_S dt + \sigma\_S dB\_t,
$$
where $B\_t$ is a standard brownian motion.

Now, the agent has CRRA utility. Thus, his decision is modelled by
the following program:

\begin{align\*}
\max\_{\{C\_t\}\_{t=0}^\infty} \quad \mathbb E\left[\int\_0^\infty e^{-\rho t}
\left ( \frac{C\_t^{1-\gamma}}{1 - \gamma} \right )
\, \mathrm d t \right ] \\
\text{ s.t. } \mathbb E \left [ \int\_0^\infty \pi\_t (c\_t - w) dt \right ] \leq W\_0,
\end{align\*}
where $\pi\_t$ is the stochastic discount factor, which can
be written as
$$
\frac{d \pi\_t}{\pi\_t} = - \mu\_{\pi} dt - \sigma\_{\pi} d B\_t.
$$

# My solution attempt

Proceeding with the Martingale method, the first-order condition on the
appropriate Lagrangian are
$$
u\_c(c\_t, t) = e^{-\rho t} C\_t^{-\gamma} = \lambda \pi\_t,
$$
where $\pi = e^{-r t} \xi\_t$, $\lambda$ is the Lagrange multiplier,
and the exponential martingale is
$\xi\_t = \exp\left (-\eta B\_t - \frac{t}{2} \eta^2 \right )$.
Note that this is based on the assumption of complete markets and
is equivalent to
$$
\frac{d \pi\_t}{\pi\_t} = - r dt - \eta d B\_t,
$$
where $\eta = \frac{\mu\_s - r}{\sigma\_s}$ is the market price of risk.

The first-order condition implies that
$C^\*\_t = \left( \lambda \pi\_t e^{\rho t} \right )^{-1/\gamma}$.
We can then substitute this into the budget constraint and
solve for $\lambda$:
\begin{align\*}
W\_0 &= \mathbb E \int\_0^\infty \pi\_t (C\_t^\* - w) \, \mathrm d t \\
0 &= \mathbb E \int\_0^\infty \pi\_t^{\frac{\gamma - 1}{\gamma}}
\lambda ^{\frac{-1}{\gamma}} \exp(-\rho t/\gamma) - \pi\_t w \, \mathrm d t.
\end{align\*}

Now, in order to proceed, let us make the following intermediate calculations:
\begin{align\*}
\mathbb E\_0[\pi\_t] &= \exp\{-r t\} \\
&\text{and} \\
\mathbb E\_0 \left [\pi\_t^{\frac{\gamma - 1}{\gamma}} \right ]
&= \mathbb E\_0 \exp \left \{
- \frac{\gamma - 1}{\gamma} \left (r + \frac 12 \eta^2 \right ) t
- \frac{\gamma - 1}{\gamma} \eta B(t) \right \} \\
&= \exp \left \{ - \frac{\gamma - 1}{\gamma} (r + \frac 12 \eta^2 ) t
+ \frac 12 \frac{(\gamma - 1)^2}{\gamma^2} \eta^2 t \right \} \\
&= \exp \left \{ -t \frac{\gamma - 1}{\gamma} \left[ r + \frac 12 \eta^2
\frac{1}{\gamma} \right] \right \}.
\end{align\*}
Because of the appropriate regularity conditions, we can exchange
the order of integration to
make the following calculations:
\begin{align\*}
\mathbb E \int\_0^\infty \pi\_t w \, \mathrm d t &= w \int\_0^\infty \mathbb E[\pi\_t] \, \mathrm d t
= w \int\_0^\infty \exp(-r t) = \frac{w}{r} \\
\text{and} \\
\mathbb E \int\_0^\infty \pi\_t^{\frac{\gamma - 1}{\gamma}}
\exp \left (\frac{-\rho t}{\gamma} \right ) \, \mathrm d t
&= \int\_0^\infty \exp(-a t) dt = a^{-1},
\end{align\*}
where $a = \frac{\rho}{\gamma} +\frac{\gamma - 1}{\gamma}
\left[r + \frac 12 \eta^2 \frac{1}{\gamma} \right ] $.
Then, continuing with the budget constraint, we
can solve for $\lambda^{-1/\gamma}$,
$$
\lambda^{-1/\gamma} = \frac{w a}{r}.
$$
We can then substitute this back into our expression for
the optimal path of consumption,
$$
C^\*\_t = \frac{w a}{r} \pi\_t^{-1/\gamma} \exp \left \{ -\frac{1}{\gamma} \rho t
\right \}.
$$

**Tags:** finance, financial-economics, academic-graduate, continuous-time, portfolio-theory
> **Comments:**
> **username_1**: I haven't looked at the derivation in detail, but I think martingale approach assumes complete markets, so that the agent can trade also his labor income stream just like any other asset (and presumably he would have to in order to support the derived consumption process). To derive optimal policy for nontraded labor income would probably require to solve agent's dynamic program explicitly.  

---

## 1 answers

### Answer by username_0 on 2017-07-12. Score: 3 | Accepted answer

$\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\E}{\mathbb{E}}
%short command for inseting abbreviated "such that" in a math environment
\newcommand{\st}{\text{ s.t. }}
%text in a math environment "as"
\newcommand{\as}{\text{ as }}
%various referencing commands
\newcommand{\rref}[1]{(\ref{#1})}
\newcommand{\eref}[1]{eq. (\ref{#1})}
\newcommand{\fref}[1]{Figure \ref{#1}}
%differential d
\newcommand{\dd}{\, \mathrm{d}}
%variance and covariance$

# Part 1

Yes. However, it is useful to simplify the answer even further and to write
optimal consumption in terms of other. more easily observed quantities.
Here's the derivation. I also solve for the portfolio holdings.

**Calculating Optimal Consumption in terms of Wealth**

Start again with some preliminary calculations related to the budget constraint.
\begin{align\*}
\mathbb E\_t \left [\pi\_T^{\frac{\gamma - 1}{\gamma}} \right ]
&= \mathbb E\_0 \pi\_t^{\frac{\gamma-1}{\gamma}} \exp \left \{
- \frac{\gamma - 1}{\gamma} \left (r + \frac 12 \eta^2 \right ) (T-t)
- \frac{\gamma - 1}{\gamma} \eta (B(T) - B(t)) \right \} \\
&= \pi\_t^{\frac{\gamma-1}{\gamma}} \exp \left \{ - \frac{\gamma - 1}{\gamma} (r + \frac 12 \eta^2 ) (T-t)
+ \frac 12 \frac{(\gamma - 1)^2}{\gamma^2} \eta^2 (T-t) \right \} \\
&= \pi\_t^{\frac{\gamma-1}{\gamma}} \exp \left \{ (T-t) \frac{\gamma - 1}{\gamma} \left[ - r + \frac 12 \eta^2
\frac{1}{\gamma} \right] \right \}.
\end{align\*}
From the budget constraint
\begin{align\*}
\pi\_t W\_t &= \E\_t \left[\int\_t^\infty \pi\_s C\_s \dd s\right] \\
W\_t &= \frac{1}{\pi\_t} \E\_t\left[\int\_t^\infty \lambda^{-1/\gamma} e^{-\frac{\rho}{\gamma} s} \pi\_s^{\frac{\gamma-1}{\gamma}} \dd s\right] \\
&= \frac{1}{\pi\_t} \int\_t^\infty \lambda^{-1/\gamma} e^{-\frac{\rho}{\gamma} s} \E\_t\left[\pi\_s^{\frac{\gamma-1}{\gamma}} \right] \dd s \\
&= \frac{1}{\pi\_t} \int\_t^\infty \lambda^{-1/\gamma} e^{-\frac{\rho}{\gamma} s} \pi\_t^{\frac{\gamma-1}{\gamma}} \exp\{-(s-t) \frac{\gamma-1}{\gamma} \left[r + \frac 12 \eta^2 \frac 1 \gamma \right]\} \dd s \\
&= \pi^{\frac{-1}{\gamma}} \lambda^{\frac{-1}{\gamma}}
\int\_t^\infty \exp\left\{ -\frac{\rho}{\gamma} (s-t) - \frac{\rho}{\gamma} t - (s-t) \frac{\gamma-1}{\gamma} \left[r + \frac 12 \eta^2 \frac 1 \gamma \right]\right\} \dd s\\
&= \pi^{\frac{-1}{\gamma}} \lambda^{\frac{-1}{\gamma}}
e^{-\frac \rho \gamma t} \int\_t^\infty \exp\left\{ - (s-t) \frac{\gamma-1}{\gamma} \left[r + \frac{\rho}{\gamma-1} + \frac 12 \eta^2 \frac 1 \gamma \right]\right\} \dd s \\
&= \pi^{\frac{-1}{\gamma}} \lambda^{\frac{-1}{\gamma}}
e^{-\frac \rho \gamma t} \frac 1 a,
\end{align\*}
where
$a =
\frac{\gamma-1}{\gamma} \left[r + \frac{\rho}{\gamma-1} + \frac 12 \eta^2 \frac 1 \gamma\right]$
(this is the same as defined in attempt demonstrated in the question).
From our derivation of optimal consumption, we have
$$
C\_t^\* = \lambda^{-\frac 1 \gamma }e^{-\frac \rho \gamma t} \pi\_t^{-\frac 1 \gamma} = a W\_t.
$$

**Deriving the dynamics for optimal consumption: $\dd C\_t^\*$.**

To proceed to find the optimal portfolio to support this level of consumption, we need to compute the dynamics of $C\_t^\*$.

We will show that, from our derivation of optimal consumption,
\begin{equation}
\dd W\_t = \frac 1 a \dd C\_t^\* =
\frac 1 a C\_t \frac 1 \gamma \left( \eta \dd Z\_t + \frac 12 \frac{1+\gamma}{\gamma} \eta^2 \dd t\right). \label{wealth-dynamics-from-optimal-consumption}
\tag 1
\end{equation}

The second equality is derived as follows.

That second equality comes from $\lambda^{-\frac 1 \gamma} = \frac {w a} r$ (derived in the attempt given in the question statement) and
from Ito's lemma applied to
\begin{align\*}
C^\*\_t &= \lambda^{-\frac 1 \gamma }e^{-\frac \rho \gamma t} \pi\_t^{-\frac 1 \gamma} \\
&= \frac {w a}{r} (e^{\rho t} \pi\_t)^{-\frac 1 \gamma} \\
&= \frac {w a}{r} \xi\_t^{-\frac 1 \gamma}.
\end{align\*}
Here I have added the simplifying assumption that $\rho = r$ and I have used the definition that
$\pi\_t = e^{-r t} \xi\_t$.
The calculation of Ito's lemma on optimal consumption proceeds like this:
\begin{align\*}
\dd C\_t &= - \frac {wa}{r} \frac 1 \gamma \xi\_t^{\frac{-1 - \gamma}{\gamma}} \dd \xi\_t
+ \frac 12 \frac{wa}{r} \frac 1 \gamma \frac{1 + \gamma}{\gamma} \xi\_t^{- \frac 1 \gamma - 2} (\dd \xi\_t)^2 \\
&= - C\_t \frac 1 \gamma \left( \frac{\dd \xi\_t}{\xi\_t} \right)
+ \frac 12 C\_t \frac 1 \gamma \frac{1+\gamma}{\gamma} \left( \frac{\dd \xi\_t}{\xi\_t}\right)^2 \\
&= -C\_t \frac 1 \gamma (-\eta \dd B\_t) + \frac 12 C\_t \frac 1 \gamma \frac{1+\gamma}{\gamma} ( \eta^2 \dd t)
\end{align\*}
Thus,
$$
\frac{ \dd C\_t}{C\_t} = \frac 1 \gamma \left( \frac 12 \eta^2 \frac{1+\gamma}\gamma \dd t + \eta \dd B\_t \right).
$$

**Match terms to derive optimal portfolio.**

We can deduce the optimal portfolio be deriving the dynamics of
a portfolio with a trading strategy defined by the weight $\omega\_t$
and comparing these dynamics to the dynamics of wealth implied by
the dynamics we calculated for
optimal consumption.

If $\omega$ is the fraction of wealth we invest in the risky security
and $1-\omega$ is the fraction invested in the riskless security,
then the dynamics for wealth can be written
$$
\dd W\_t = \omega (\mu -r) W\_t \dd t + (r W\_t - C\_t) \dd t + W\_t \omega \sigma \dd Z\_t.
$$

Now, we can derive an expression for $\omega$ by matching the terms
of this equation with the terms of equation (\ref{wealth-dynamics-from-optimal-consumption}).
From the terms on $\dd Z\_t$,
\begin{align\*}
W\_t \omega \sigma &= \frac 1 a C\_t \frac 1 \gamma \eta \\
\omega &= \frac \eta {\sigma \gamma}.
\end{align\*}

# Part 2

It seems like consumption is stochastic because consumption here *is* stochastic.
Consumption
depends on the state of the economy. It is, however,
$\mathcal F\_t$-measurable, so optimal consumption at time $t$
depends only on information available at time $t$.
Because of the positive Sharpe ratio $\eta$ and finite risk aversion, the agent will invest in the risky security. As we showed previously, consumption
is a fraction of wealth, $C\_t^\* = a W\_t$. Wealth depends on the performance
of the agent's investments. In good times, the agent consumes more.
The fraction of wealth consumed, $a$, depends on
the interest rate $r$, subjective discounting $\rho$, risk aversion
$\gamma$, and the market price of risk (Sharpe ratio) $\eta$.

# Part 3

One way this can occur is if we assume that the agent can only invest
in the riskless security. Just as well, let $\eta = 0$. Also,
suppose that the interest rate is equal to the subjective discount rate, $r = \rho$.

Doing this, we see that $\pi\_t = \exp\{-r t\}$. Also, from
the budget constraint we know that wealth is
$$
W\_t = B\_t + \theta\_t S\_t + \E\_t \frac{1}{\pi\_t} \int\_t^\infty \pi\_s w \dd s = B\_t + \theta\_t S\_t + \frac w r,
$$
where $B\_t$ is the amount on money invested in the riskless asset, $\theta\_t$
is the dollar amount invested in the risky security $S\_t$, and the remaining
term is the expected discounted present value of future wages (the expectation
here could have been left out since $\pi\_s$ and $w$ are constant in this case,
but I've included
it for consistency).
Also, since $\eta = 0$, $a = r$. Thus,
$$
C\_t^\* = r W\_t = r \left( B\_t + \frac w r\right).
$$
Since $B\_0 = 0$ by assumption, $C\_0 = w$. Loosely speaking, an induction-like
argument gives us that $B\_t = 0$ for all $t$ and, thus,
$$
C\_t^\* = \frac w r = w.
$$


---

