Calculate Ramsey steady states


I wanted to solve a Ramsey optimal policy in Dynare. My policy instrument is a quantity variable. I first assumed the policy instrument variable is an exogenous constant and wrote a external steady state file to compute the steady states. The code works.

Next, I removed the exogenous policy instrument specification from the mod file and added ramsey_model with that quantity variable as the policy instrument. But dynare returns that it cannot find the steady state of the model.

I understand that the Ramsey problem will solve for the optimal policy variable, which is different to the exogenous value I specified in the external steady state file, and will affect the steady state of other variables. Then how should I specify the steady state value for the policy variable in the Ramsey problem?

Are you sure your problem has a steady state? Or may the optimal policy involve an unbounded equilibrium? If you think there should be a steady state, please provide the files. From what you describe, you should already have the required conditional steady state file.

Dear jpferfer,

I have a conditional steady state file, but it is conditional on the policy instrument being exogenously given as a constant. I haven’t figured out how to write the steady state file conditional on the policy instrument being optimally determined.

I am attaching my code. In the code, Ds is the policy instrument, and is set to zero when I don’t solve for the Ramsey problem. The three m files are used to calculate the steady state externally.

My guess is that I need to find an optimal condition for the policy instrument, but I don’t how. Any suggestion is appreciated.

bankss.m (446 Bytes)
nobankss.m (406 Bytes)
Test_file_3.mod (1.8 KB)
Test_file_3_steadystate.m (2.7 KB)

Providing an initial value to policy instrument

Your initial value for the instrument Ds was not passed to the steady state file. Also, you did not correctly handle the non-solution of your solvers. It should be:

function [ys,check] = Test_file_3_steadystate(ys,exo)
% function [ys,check] = alpha_steadystate(ys,exo)
% computes the steady state for the alpha.mod and uses a numerical
% solver to do so
% Inputs: 
%   - ys        [vector] vector of initial values for the steady state of
%                   the endogenous variables
%   - exo       [vector] vector of values for the exogenous variables
% Output: 
%   - ys        [vector] vector of steady state values fpr the the endogenous variables
%   - check     [scalar] set to 0 if steady state computation worked and to
%                    1 of not (allows to impos restriction on parameteRsss)

global M_   

NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
  varname = deblank(M_.endo_names(ii,:));
  eval([varname '= ys(' int2str(ii) ');']);

% read out parameteRsss to access them with their name
NumberOfParametes = M_.param_nbr;
for ii = 1:NumberOfParametes
  paramname = deblank(M_.param_names(ii,:));
  eval([ paramname ' = M_.params(' int2str(ii) ');']);
% initialize indicator
check = 0;

% bank core steady state
options = optimoptions('fsolve','TolFun',1e-15, 'MaxIter', 1e8,'Display','off','MaxFunctionEvaluations',500);
[xx,fval,exitflag]=fsolve(@bankss, x0, options, betta, sigmma, gama, thetta, Rsss);

if exitflag<1

x = xx(1);
phi = xx(2);
Rc = xx(3);

R = 1/betta;
psi = thetta*(1+gama*x^2/2)*phi;
mu = betta*(1-sigmma+sigmma*psi)*(Rc-R);
mus = betta*(1-sigmma+sigmma*psi)*(R-Rsss);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  non-bank steady state
Q = 1;
A = 1;
Rs = Rsss;
Ys = Ysss;
G = Gss;

% Ds = 0; % not sure how to specify Ds in the steady state when it is optimally determined

[xxx,fval,exitflag]=fsolve(@nobankss, xx0, options, Ysss, alphaK,  alphaL,  alphaM, sigmmaL, delta, chi, eta, Rc, Rsss, x, Ds);

if exitflag<1

Y = xxx(1);
e = xxx(2);

Rk = Rc-1+delta;
aky = alphaK/Rk;
K = aky*Y;
L = (alphaL*Y/chi)^(1/(1+sigmmaL));
M = alphaM*Y/e;
EX = e^eta*Ysss;
Bs = Q*K*x/e;
C = Y-delta*K-G-EX;
W = chi*L^sigmmaL;
I = delta*K;

% remaining steady state
N = Q*K/phi;
B = (1-1/phi-x)*Q*K;
nu = (1-sigmma+sigmma*psi);
T = G+e*Ds-e*Rs*Ds;
utility = log(C-chi*L^(1+sigmmaL)/(1+sigmmaL));

for iter = 1:length(M_.params) % update parameter set in the file
  eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])

NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
  varname = deblank(M_.endo_names(ii,:));
  eval(['ys(' int2str(ii) ') = ' varname ';']);

Thank you for your response. I now understand that I need to provide an initial value for the instrument to the steady state file, but I still did not figure out how to do that. Do you have an example code that shows how to include the instrument variable in the steady state file?

Another thing is that the code now runs, but it returns the following error message:

“Ramsey: The maximum number of iterations has been reached. Try increasing maxit.”

Does this imply the model does not have a optimal steady state for the instrument?



In addition, the residuals of the equations did not equal to zero.

You already set an initial value using initval. I also got the error message you got. You should try different initial values for the instrument and try to increase maxit as posted above. But it might be that no steady state exists.