# Ramsey Policy

**URL:** <https://forum.dynare.org/t/ramsey-policy/5447>\
**Category:** Optimal Policy\
**Created:** [16 April 2016 13:59 UTC](https://forum.dynare.org/t/ramsey-policy/5447 "2016-04-16T13:59:42Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![jd1090](https://forum.dynare.org/user_avatar/forum.dynare.org/jd1090/32/5086_2.png) [@jd1090](https://forum.dynare.org/u/jd1090)\
**Post date:** [7 May 2016 15:47 UTC](https://forum.dynare.org/t/ramsey-policy/5447/14 "2016-05-07T15:47:17Z")

</div>

You may be right that my model contains an economic problem (I cannot guarantee that). For this reason, I took the most well known open economy framework (Gali & Monacelli(2005)) and wrote the mod file for the non-linear version of the model (i.e. I do not log-linearise by hand). I also include capital and define the net exports in a slightly different way, but these changes make no real difference to the end result. There are no further frictions.

I also wrote the .tex file (see pdf below and .tex code at the very bottom) with all the equilibrium conditions and detailed derivations of the conditional steady state. I suspect that the problem may arise do the misspecification of the price level steady state, but I’m not sure (which is why I keep pestering you on this blog post to begin with 🙂 ).

In this case, the error message is different:

[code]  
Warning: Rank deficient, rank = 0, tol = NaN.

> In dyn\_ramsey\_static\_dyn\_ramsey\_static\_1 (line 152)  
> In dyn\_ramsey\_static\>@(x)dyn\_ramsey\_static\_1(x,M,options\_,oo) (line 43)  
> In csolve (line 112)  
> In dyn\_ramsey\_static (line 58)  
> In evaluate\_steady\_state (line 120)  
> In resol (line 104)  
> In stoch\_simul (line 83)  
> In ramsey\_policy (line 25)  
> In GM\_2005 (line 542)  
> In dynare (line 223)

evaluate\_steady\_state: The steady state computation for the Ramsey problem resulted in NaNs.  
evaluate\_steady\_state: The steady state computation resulted in the following instrument values:  
i 0.010050  
evaluate\_steady\_state: The problem occured in the following equations:  
Equation(s): 1, 33, 34,  
Error using print\_info (line 140)  
Ramsey: The steady state computation resulted in NaN in the static first order conditions for optimal policy  
Error in stoch\_simul (line 94)  
print\_info(info, options\_.noprint, options\_);  
Error in ramsey\_policy (line 25)  
info = stoch\_simul(var\_list);  
Error in GM\_2008 (line 542)  
ramsey\_policy(var\_list\_);  
Error in dynare (line 223)  
evalin(‘base’,fname) ; [/code]

P.S. Apologies for yet another question on this, but this is really bothering me. Hopefully we can figure this out and you can put this example on github, so that others in the future would not have to struggle as much as I am.

> [@](#):
>
> \documentclass[11pt]{article}  
> \usepackage{amsmath, amssymb}  
> \usepackage{mathtools}  
> \usepackage{graphicx}  
> \usepackage{float}  
> \usepackage{natbib}  
> \bibliographystyle{agsm}  
> \begin{document}
> 
> \title{Running the Ramsey Policy on a Non-Linear\ Gali & Monacelli (2005) Model using Dynare}  
> \author{Justas Dainauskas\footnote{University of York, Department of Economics and Related Studies, Heslington, York, YO10 5DD, United Kingdom. E-Mail: [jd1090@york.ac.uk](mailto:jd1090@york.ac.uk)}}  
> \maketitle
> 
> \section{The Model}  
> Consider the ubiquitous \cite{GaliMonacelli(2005)} model of a small open economy in its non-linear form. The only real difference here is that the capital stock is present in the model and the dynamics of inflation are summarised in a recursive way similar to the \texttt{NK\_baseline.mod} in the dynare example folder. The trade balance is specified in a slightly different way, but it makes no real difference. There are no additional frictions introduced into the model and the notation used is consistent with \cite{GaliMonacelli(2005)} as much as possible, so all of the equilibrium conditions are standard:  
> \begin{equation}  
> Y\_t=C\_t+I\_t+NX\_t  
> \end{equation}  
> \begin{equation}  
> NX\_t=X\_t-M\_t  
> \end{equation}  
> \begin{equation}  
> X\_t=\alpha\left(\frac{P\_{H,t}}{E\_tP\_{F,t}}\right)^{-\eta}C\_t^\*  
> \end{equation}  
> \begin{equation}  
> M\_t=\alpha\left(\frac{E\_tP\_{F,t}}{P\_t}\right)^{-\eta}C\_t  
> \end{equation}  
> \begin{equation}  
> C\_{H,t}=(1-\alpha)\left(\frac{P\_{H,t}}{P\_{t}}\right)^{-\eta}C\_t  
> \end{equation}  
> \begin{equation}  
> C\_{F,t}=\alpha\left(\frac{E\_tP\_{F,t}}{P\_{t}}\right)^{-\eta}C\_t  
> \end{equation}  
> \begin{equation}  
> C\_t+I\_t+\mathbb{E}_t\left[D_{t+1} \mathit{\Lambda}_{t,t+1} \mathit{\Pi}_{t+1}\right]=\frac{D\_t}{P\_t}+\frac{W\_tN\_t}{P\_t}+\frac{R\_tK\_{t-1}}{P\_t}+\frac{\mathit{\Xi}_t}{P\_t}  
> \end{equation}  
> \begin{equation}  
> \mathit{\Xi}t=P{H,t}Y\_t-W\_tN\_t-R\_tK_{t-1}  
> \end{equation}  
> \begin{equation}  
> \mathbb{E}_t\left\mathit{\Lambda}_{t,t+1}\right]=\exp(-i\_t)  
> \end{equation}  
> \begin{equation}  
> \mathbb{E}_t\left\mathit{\Pi}_{t+1}\right]=\mathbb{E}_t\left\frac{P_{t+1}}{P\_t}\right]  
> \end{equation}  
> \begin{equation}  
> \frac{W\_t}{P\_t}=\frac{N^\varphi}{\mathbb{U}_{c,t}}  
> \end{equation}  
> \begin{equation}  
> \mathbb{U}_{c,t}=C^{-\sigma}  
> \end{equation}  
> \begin{equation}  
> \mathbb{E}_t\left\mathit{\Lambda}_{t,t+1}\mathit{\Pi}_{t+1}\right]=\beta\left\frac{\mathbb{U}_{c,t+1}}{\mathbb{U}_{c,t}}\right]  
> \end{equation}  
> \begin{equation}  
> \frac{R_{t+1}}{P\_{t+1}}=\mathbb{E}_t\left\left(\frac{\mathbb{U}_{c,t+1}}{\mathbb{U}_{c,t}}\right)\left(\frac{1}{\beta}-(1-\delta)\right)\right]  
> \end{equation}  
> \begin{equation}  
> Y=\frac{A\_tK_{t-1}^\gamma N\_t^{1-\gamma}}{\mathit{\Theta}_t}  
> \end{equation}  
> \begin{equation}  
> \frac{W\_t}{P\_t}=(1-\gamma)MC\_t\left(\frac{Y\_t}{N\_t}\right)  
> \end{equation}  
> \begin{equation}  
> \frac{R\_t}{P\_t}=\gamma MC\_t\left(\frac{Y\_t}{K_{t-1}}\right)  
> \end{equation}  
> \begin{equation}  
> K\_t=(1-\delta)K\_{t-1}+I\_t  
> \end{equation}  
> \begin{equation}  
> MC\_t=\frac{1}{P\_tA\_t}\left(\frac{R\_t}{\gamma}\right)^\gamma\left(\frac{W\_t}{1-\gamma}\right)^{1-\gamma}  
> \end{equation}  
> \begin{equation}  
> P\_{H,t}=\left(1-\pi),\hat{P}_{H,t}^{1-\varepsilon}+\pi,P_{H,t-1}^{1-\varepsilon}\right]^{\frac{1}{1-\varepsilon}}  
> \end{equation}  
> \begin{equation}  
> \hat{P}_{H,t}=\frac{P\_t \mathit{\Phi}_{t,1}}{\mathit{\Phi}_{t,1}}  
> \end{equation}  
> \begin{equation}  
> \mathit{\Phi}_{t,1}=\left(\frac{\varepsilon}{\varepsilon-1}\right)Y\_t \mathbb{U}_{c,t} MC_{t}+\theta\beta,\mathbb{E}_t \left\mathit{\Pi}_{t+1}^\varepsilon,\mathit{\Phi}_{t+1,1}\right]  
> \end{equation}  
> \begin{equation}  
> \mathit{\Phi}_{t,2}=Y\_t \mathbb{U}_{c,t}+\theta\beta,\mathbb{E}t\left\mathit{\Pi}{t+1}^{\varepsilon-1},\mathit{\Phi}_{t+1,2}\right]  
> \end{equation}  
> \begin{equation}  
> \mathit{\Theta}_{t}=\pi\mathit{\Pi}_{H,t}^\varepsilon\mathit{\Theta}_{t-1}+(1-\pi)\left(\frac{\widehat{P}_{H,t}}{P\_{t}}\right)^{-\varepsilon}  
> \end{equation}  
> \begin{equation}  
> \mathbb{E}_t\left\mathit{\Pi}_{H,t+1}\right]=\mathbb{E}_t\left\frac{P_{t+1}}{P\_t}\right]  
> \end{equation}  
> \begin{equation}  
> \mathbb{U}_{c,t}^=C^{ -\sigma}  
> \end{equation}  
> \begin{equation}  
> P\_t=\left(1-(1-\mu)\alpha),(P_{H,t})^{1-\eta}+(1-\mu)\alpha(P\_{F,t})^{1-\eta}\right]^{\frac{1}{1-\eta}}  
> \end{equation}  
> \begin{equation}  
> Q\_t=\frac{\mathbb{U}_{c,t}^\*}{\mathbb{U}_{c,t}}  
> \end{equation}  
> \begin{equation}  
> E\_t=\frac{Q\_t P\_t}{P\_{F,t}}  
> \end{equation}  
> \begin{equation}  
> \log(A\_t)=\rho\_a,\log(A\_{t-1})+e\_{a,t},,,,,,\rho\_a\in(0,1),,,,,,e\_{a,t} \sim,iid(0,\sigma\_{a}^2)  
> \end{equation}  
> \begin{equation}  
> \log(C\_t^_)=(1-\rho\_{c})\log(C)+\rho\_{c},\log(C\_{t-1}^_)+e\_{c,t},,,e\_{c,t} \sim,iid(0,\sigma\_{c}^2)  
> \end{equation}  
> And for non-Ramsey policy case, the single mandate Taylor rule:  
> \begin{equation}  
> i\_t=-\log(\beta)+\phi,\log(\mathit{\Pi}\_{t})  
> \end{equation}  
> Given the assumption that the policy \texttt{instrument} is i\_t and the \texttt{planner\_objective} is given by the CRRA preferences:  
> \begin{equation}  
> \frac{C\_t^{1-\sigma}}{1-\sigma}-\frac{N\_t^{1+\varphi}}{1+\varphi}  
> \end{equation}
> 
> \section{Conditional Steady State}  
> Derivations of the real variable steady state values must be conditional on the instrument used for the Ramsey policy, which is chosen to be the nominal interest rate i\_t. The nominal instrument affects the demand side of the economy via the Euler equation. Specifically, it is the reciprocal of the stochastic discount factor:  
> $$\mathit{\Lambda}=\exp(-i)$$  
> The stochastic discount factor affects the CPI inflation:  
> $$\mathit{\Pi}=\frac{\beta}{\mathit{\Lambda}}$$  
> The specification of the price levels is less clear, because the steady state must be consistent with any value of the instrument, which means that there may be non-zero inflation steady state. This implies that the price level is rising over time. For this reason, I specify the CPI level as equivalent to the CPI inflation rate (which implicitly assumes that the CPI level in the previous period is always equal to unity and I’m not sure how to specify this in any other way):  
> $$P\equiv\mathit{\Pi}$$  
> Then it follows that the real marginal costs of production must equal to the inverse mark-up:  
> $$MC=\frac{1}{PA}\left(\frac{R}{\zeta}\right)^\zeta\left(\frac{W}{(1-\zeta)}\right)^{1-\zeta}=\frac{\varepsilon-1}{\varepsilon}$$  
> $$\mathit{\Phi}_{1}=\mathit{\Phi}_{2}=\frac{Y C^{-\sigma}}{1-\mathit{\Pi}\pi\beta}$$  
> $$\widehat{P}_H=\frac{\mathit{P \Phi}_{1}}{\mathit{\Phi}\_{2}}\equiv \mathit{\Pi}$$  
> Then note that the trade balance holds in the steady state:  
> $$X=M=\alpha C\Rightarrow NX=0$$  
> Where the above follows from the symmetry of preferences and the consumption risk-sharing relationship:  
> $$Q=\left(\frac{C}{C^_}\right)^{\sigma}\equiv\frac{E P\_F}{P}=1 \Rightarrow C=C^_$$  
> Therefore the aggregate resource constraint is given by:  
> $$Y=C+I$$  
> Where aggregate investment is obtained from the capital accumulation equation:  
> $$I=\delta K$$  
> In order to find the market clearing steady state of capital stock, consider the demand and supply schedules of capital:  
> $$R=\frac{1-\beta(1-\delta)}{\beta}$$  
> $$R=\frac{\zeta MC Y}{K}\equiv \left(\frac{\varepsilon-1}{\varepsilon}\right)\frac{\zeta Y}{K}$$  
> Then solving the above two equations for capital stock gives:  
> $$K=\left\left(\frac{\varepsilon-1}{\varepsilon}\right)\left(\frac{\zeta\beta}{1-\beta(1-\delta)}\right)\right]Y\equiv\mathit{\Delta}\_1 Y$$  
> Then substitute the above into the production function and solve for output:  
> $$Y=K^\zeta N^{1-\zeta}\equiv N \mathit{\Delta}\_1^{\frac{\zeta}{1-\zeta}}$$  
> Then the aggregate investment is equivalent to:  
> $$I=\delta K=\delta \mathit{\Delta}\_1 Y= \delta N \mathit{\Delta}\_1^{\frac{1}{1-\zeta}}$$  
> Substituting out output and investment from the aggregate budget constraint identifies the steady state of aggregate consumption:  
> $$C=Y-I=N\left\mathit{\Delta}\_1^{\frac{\zeta}{1-\zeta}}+\delta \mathit{\Delta}\_1^{\frac{1}{1-\zeta}}\right]\equiv \mathit{\Delta}\_2 N$$  
> The labour demand schedules defines real wage:  
> $$\frac{W}{P}=\left(\frac{\varepsilon-1}{\varepsilon}\right)(1-\zeta)\mathit{\Delta}\_1^{\frac{\zeta}{1-\zeta}}$$  
> Thus the aggregate hours can therefore be identified from the inverse labour supply schedule:  
> $$\frac{W}{P}=N^\varphi C^\sigma$$  
> $$\Rightarrow \left(\frac{\varepsilon-1}{\varepsilon}\right)(1-\zeta)\mathit{\Delta}\_1^{\frac{\zeta}{1-\zeta}}=N^{\varphi+\sigma} \mathit{\Delta}\_2^\sigma$$  
> $$\Rightarrow N=\left\mathit{\Delta}\_2^{-\sigma}\left(\frac{\varepsilon-1}{\varepsilon}\right)(1-\zeta)\mathit{\Delta}\_1^{\frac{\zeta}{1-\zeta}}\right]^{\frac{1}{\varphi+\sigma}}$$  
> Then the consumption allocation between the domestic goods and foreign goods is given by:  
> $$C\_H=(1-\alpha)C$$  
> $$C\_F=\alpha C$$  
> And finally, the amount of assets held by the domestic households in the steady state is obtained from the budget constraint:  
> $$PC+PI+\beta D=D+WN+RK+\mathit{\Xi}$$  
> $$\mathit{\Xi}=P\_H Y-W N-RK$$  
> $$(\beta-1)D=0$$  
> $$\Rightarrow D=0$$
> 
> \section{Dynare Code}  
> See \texttt{GM\_2005.mod} attached.
> 
> \bibliography{references}
> 
> \end{document}

[GM\_2005.pdf](https://forum.dynare.org/uploads/default/original/2X/0/0e43fc3f29c4f92371daec299c9c221cbd8dbe47.pdf) (208 KB)  
[GM\_2005.mod](https://forum.dynare.org/uploads/default/original/2X/5/5b7cd90ad7085668df05a51855e68099eadf9895.mod) (13.5 KB)

---

_[View the full topic](https://forum.dynare.org/t/ramsey-policy/5447)._
