From 554849a70457701b7874d6bb14878ee0597e4df6 Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Sun, 27 Mar 2011 16:54:49 +0200 Subject: [PATCH] modifyimg *.m files for ramsey_policy when FOC are computed by the preprocessor --- matlab/disp_dr.m | 4 + matlab/dr1.m | 91 +++++----- matlab/dyn_ramsey_dynamic_.m | 281 ----------------------------- matlab/dyn_ramsey_static_.m | 47 ++--- tests/optimal_policy/nk_ramsey.mod | 90 +++++++++ tests/optimal_policy/ramsey.mod | 2 + 6 files changed, 156 insertions(+), 359 deletions(-) delete mode 100644 matlab/dyn_ramsey_dynamic_.m create mode 100644 tests/optimal_policy/nk_ramsey.mod diff --git a/matlab/disp_dr.m b/matlab/disp_dr.m index 6a5440106..d9b87bbbc 100644 --- a/matlab/disp_dr.m +++ b/matlab/disp_dr.m @@ -239,6 +239,10 @@ for i = 1:length(M_.aux_vars) case 4 str = sprintf('EXPECTATION(%d)(...)', aux_lead_lag); return + case 6 + str = sprintf('%s(%d)', ... + deblank(M_.endo_names(M_.aux_vars(i).endo_index, :)),aux_lead_lag); + return otherwise error(sprintf('Invalid auxiliary type: %s', M_.endo_names(aux_index, :))) end diff --git a/matlab/dr1.m b/matlab/dr1.m index ddeecda09..c0418e8ca 100644 --- a/matlab/dr1.m +++ b/matlab/dr1.m @@ -121,9 +121,11 @@ if options_.ramsey_policy oo_.steady_state = x; [junk,junk,multbar] = dyn_ramsey_static_(oo_.steady_state(k_inst),M_,options_,oo_,it_); else - [oo_.steady_state,info1] = dynare_solve('dyn_ramsey_static_', ... - oo_.steady_state,0,M_,options_,oo_,it_); - [junk,junk,multbar] = dyn_ramsey_static_(oo_.steady_state,M_,options_,oo_,it_); + xx = oo_.steady_state([1:M_.orig_endo_nbr (M_.orig_endo_nbr+M_.orig_eq_nbr+1):end]); + [xx,info1] = dynare_solve('dyn_ramsey_static_', ... + xx,0,M_,options_,oo_,it_); + [junk,junk,multbar] = dyn_ramsey_static_(xx,M_,options_,oo_,it_); + oo_.steady_state = [xx; multbar]; end check1 = max(abs(feval([M_.fname '_static'],... @@ -135,51 +137,46 @@ if options_.ramsey_policy info(2) = check1'*check1; return end - - [jacobia_,M_,dr] = dyn_ramsey_dynamic_(oo_.steady_state,multbar,M_,options_,dr,it_); - klen = M_.maximum_lag + M_.maximum_lead + 1; - dr.ys = [oo_.steady_state;zeros(M_.exo_nbr,1);multbar]; - oo_.steady_state = dr.ys; -else - klen = M_.maximum_lag + M_.maximum_lead + 1; - iyv = M_.lead_lag_incidence'; - iyv = iyv(:); - iyr0 = find(iyv) ; - it_ = M_.maximum_lag + 1 ; - - if M_.exo_nbr == 0 - oo_.exo_steady_state = [] ; - end - - it_ = M_.maximum_lag + 1; - z = repmat(dr.ys,1,klen); - if ~options_.bytecode - z = z(iyr0) ; + dr.ys = oo_.steady_state; +end +klen = M_.maximum_lag + M_.maximum_lead + 1; +iyv = M_.lead_lag_incidence'; +iyv = iyv(:); +iyr0 = find(iyv) ; +it_ = M_.maximum_lag + 1 ; + +if M_.exo_nbr == 0 + oo_.exo_steady_state = [] ; +end + +it_ = M_.maximum_lag + 1; +z = repmat(dr.ys,1,klen); +if ~options_.bytecode + z = z(iyr0) ; +end; +if options_.order == 1 + if (options_.bytecode) + [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,[oo_.exo_simul ... + oo_.exo_det_simul], M_.params, dr.ys, 1); + jacobia_ = [loc_dr.g1 loc_dr.g1_x loc_dr.g1_xd]; + else + [junk,jacobia_] = feval([M_.fname '_dynamic'],z,[oo_.exo_simul ... + oo_.exo_det_simul], M_.params, dr.ys, it_); end; - if options_.order == 1 - if (options_.bytecode) - [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,[oo_.exo_simul ... - oo_.exo_det_simul], M_.params, dr.ys, 1); - jacobia_ = [loc_dr.g1 loc_dr.g1_x loc_dr.g1_xd]; - else - [junk,jacobia_] = feval([M_.fname '_dynamic'],z,[oo_.exo_simul ... - oo_.exo_det_simul], M_.params, dr.ys, it_); - end; - elseif options_.order == 2 - if (options_.bytecode) - [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,[oo_.exo_simul ... - oo_.exo_det_simul], M_.params, dr.ys, 1); - jacobia_ = [loc_dr.g1 loc_dr.g1_x]; - else - [junk,jacobia_,hessian1] = feval([M_.fname '_dynamic'],z,... - [oo_.exo_simul ... - oo_.exo_det_simul], M_.params, dr.ys, it_); - end; - if options_.use_dll - % In USE_DLL mode, the hessian is in the 3-column sparse representation - hessian1 = sparse(hessian1(:,1), hessian1(:,2), hessian1(:,3), ... - size(jacobia_, 1), size(jacobia_, 2)*size(jacobia_, 2)); - end +elseif options_.order == 2 + if (options_.bytecode) + [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,[oo_.exo_simul ... + oo_.exo_det_simul], M_.params, dr.ys, 1); + jacobia_ = [loc_dr.g1 loc_dr.g1_x]; + else + [junk,jacobia_,hessian1] = feval([M_.fname '_dynamic'],z,... + [oo_.exo_simul ... + oo_.exo_det_simul], M_.params, dr.ys, it_); + end; + if options_.use_dll + % In USE_DLL mode, the hessian is in the 3-column sparse representation + hessian1 = sparse(hessian1(:,1), hessian1(:,2), hessian1(:,3), ... + size(jacobia_, 1), size(jacobia_, 2)*size(jacobia_, 2)); end end diff --git a/matlab/dyn_ramsey_dynamic_.m b/matlab/dyn_ramsey_dynamic_.m deleted file mode 100644 index 28f2c28de..000000000 --- a/matlab/dyn_ramsey_dynamic_.m +++ /dev/null @@ -1,281 +0,0 @@ -function [J,M_,dr] = dyn_ramsey_dynamic_(ys,lbar,M_,options_,dr,it_) -% function J = dyn_ramsey_dynamic_(ys,lbar) -% dyn_ramsey_dynamic_ sets up the Jacobian of the expanded model for optimal -% policies. It modifies several fields of M_ -% -% INPUTS: -% ys: steady state of original endogenous variables -% lbar: steady state of Lagrange multipliers -% -% OUPTUTS: -% J: jaocobian of expanded model -% -% SPECIAL REQUIREMENTS -% none - -% Copyright (C) 2003-2011 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see . - -persistent old_lead_lag - -% retrieving model parameters -endo_nbr = M_.endo_nbr; -i_endo_nbr = 1:endo_nbr; -endo_names = M_.endo_names; -% exo_nbr = M_.exo_nbr+M_.exo_det_nbr; -% exo_names = vertcat(M_.exo_names,M_.exo_det_names); -exo_nbr = M_.exo_nbr; -exo_names = M_.exo_names; -i_leadlag = M_.lead_lag_incidence; -max_lead = M_.maximum_lead; -max_endo_lead = M_.maximum_endo_lead; -max_lag = M_.maximum_lag; -max_endo_lag = M_.maximum_endo_lag; -leadlag_nbr = max_lead+max_lag+1; -fname = M_.fname; -% instr_names = options_.olr_inst; -% instr_nbr = size(options_.olr_inst,1); - -% discount factor -beta = options_.planner_discount; - -% storing original values -orig_model.endo_nbr = endo_nbr; -orig_model.orig_endo_nbr = M_.orig_endo_nbr; -orig_model.aux_vars = M_.aux_vars; -orig_model.endo_names = endo_names; -orig_model.lead_lag_incidence = i_leadlag; -orig_model.maximum_lead = max_lead; -orig_model.maximum_endo_lead = max_endo_lead; -orig_model.maximum_lag = max_lag; -orig_model.maximum_endo_lag = max_endo_lag; - -y = repmat(ys,1,max_lag+max_lead+1); -k = find(i_leadlag'); - -% retrieving derivatives of the objective function -[U,Uy,Uyy] = feval([fname '_objective_static'],ys,zeros(1,exo_nbr), M_.params); -Uy = Uy'; -Uyy = reshape(Uyy,endo_nbr,endo_nbr); - -% retrieving derivatives of original model -[f,fJ,fH] = feval([fname '_dynamic'],y(k),zeros(2,exo_nbr), M_.params, ys, ... - it_); -instr_nbr = endo_nbr - size(f,1); -mult_nbr = endo_nbr-instr_nbr; - -% parameters for expanded model -endo_nbr1 = 2*endo_nbr-instr_nbr+exo_nbr; -max_lead1 = max_lead + max_lag; -max_lag1 = max_lead1; -max_leadlag1 = max_lead1; - -% adding new variables names -endo_names1 = endo_names; -% adding shocks to endogenous variables -endo_names1 = char(endo_names1, exo_names); -% adding multipliers names -for i=1:mult_nbr; - endo_names1 = char(endo_names1,['mult_' int2str(i)]); -end - -% expanding matrix of lead/lag incidence -% -% multipliers lead/lag incidence -i_mult = []; -for i=1:leadlag_nbr - i_mult = [any(fJ(:,nonzeros(i_leadlag(i,:))) ~= 0,2)' ; i_mult]; -end -% putting it all together: -% original variables, exogenous variables made endogenous, multipliers -% -% number of original dynamic variables -n_dyn = nnz(i_leadlag); -% numbering columns of dynamic multipliers to be put in the last columns -% of the new Jacobian -i_leadlag1 = [cumsum(i_leadlag(1:max_lag,:),1); ... - repmat(i_leadlag(max_lag+1,:),leadlag_nbr,1); ... - flipud(cumsum(flipud(i_leadlag(max_lag+2:end,:)),1))]; -i_leadlag1 = i_leadlag1'; -k = find(i_leadlag1 > 0); -n = length(k); -i_leadlag1(k) = 1:n; -i_leadlag1 = i_leadlag1'; -i_mult = i_mult'; -k = find(i_mult > 0); -i_mult(k) = n+leadlag_nbr*exo_nbr+(1:length(k)); -i_mult = i_mult'; -i_leadlag1 = [ i_leadlag1 ... - [zeros(max_lag,exo_nbr);... - reshape(n+(1:leadlag_nbr*exo_nbr),exo_nbr,leadlag_nbr)'; ... - zeros(max_lead,exo_nbr)] ... - [zeros(max_lag,mult_nbr);... - i_mult;... - zeros(max_lead,mult_nbr)]]; -i_leadlag1 = i_leadlag1'; -k = find(i_leadlag1 > 0); -n = length(k); -i_leadlag1(k) = 1:n; -i_leadlag1 = i_leadlag1'; - -% building Jacobian of expanded model -jacobian = zeros(endo_nbr+mult_nbr,nnz(i_leadlag1)+exo_nbr); -% derivatives of f.o.c. w.r. to endogenous variables -% to be rearranged further down -lbarfH = lbar'*fH; -% indices of Hessian columns -n1 = nnz(i_leadlag)+exo_nbr; -iH = reshape(1:n1^2,n1,n1); -J = zeros(endo_nbr1,nnz(i_leadlag1)+exo_nbr); -% second order derivatives of objective function -J(1:endo_nbr,i_leadlag1(max_leadlag1+1,1:endo_nbr)) = Uyy; -% loop on lead/lags in expanded model -for i=1:2*max_leadlag1 + 1 - % index of variables at the current lag in expanded model - kc = find(i_leadlag1(i,i_endo_nbr) > 0); - t1 = max(1,i-max_leadlag1); - t2 = min(i,max_leadlag1+1); - % loop on lead/lag blocks of relevant 1st order derivatives - for j = t1:t2 - % derivatives w.r. endogenous variables - ic = find(i_leadlag(i-j+1,:) > 0 ); - kc1 = i_leadlag(i-j+1,ic); - [junk,ic1,ic2] = intersect(ic,kc); - kc2 = i_leadlag1(i,kc(ic2)); - ir = find(i_leadlag(max_leadlag1+2-j,:) > 0 ); - kr1 = i_leadlag(max_leadlag1+2-j,ir); - J(ir,kc2) = J(ir,kc2) + beta^(j-max_lead-1)... - *reshape(lbarfH(iH(kr1,kc1)),length(kr1),length(kc1)); - end -end -% derivatives w.r. aux. variables for lead/lag exogenous shocks -for i=1:leadlag_nbr - kc = i_leadlag1(max_lag+i,endo_nbr+(1:exo_nbr)); - ir = find(i_leadlag(leadlag_nbr+1-i,:) > 0); - kr1 = i_leadlag(leadlag_nbr+1-i,ir); - J(ir,kc) = beta^(i-max_lead-1)... - *reshape(lbarfH(iH(kr1,n_dyn+(1:exo_nbr))),length(kr1), ... - exo_nbr); -end -% derivatives w.r. Lagrange multipliers -for i=1:leadlag_nbr - ic1 = find(i_leadlag(leadlag_nbr+1-i,:) > 0); - kc1 = i_leadlag(leadlag_nbr+1-i,ic1); - ic2 = find(i_leadlag1(max_lag+i,endo_nbr+exo_nbr+(1:mult_nbr)) > 0); - kc2 = i_leadlag1(max_lag+i,endo_nbr+exo_nbr+ic2); - J(ic1,kc2) = beta^(i-max_lead-1)*fJ(ic2,kc1)'; -end - -% Jacobian of original equations -% -% w.r. endogenous variables -ir = endo_nbr+(1:endo_nbr-instr_nbr); -for i=1:leadlag_nbr - ic1 = find(i_leadlag(i,:) > 0); - kc1 = i_leadlag(i,ic1); - ic2 = find(i_leadlag1(max_lead+i,:) > 0); - kc2 = i_leadlag1(max_lead+i,ic2); - [junk,junk,ic3] = intersect(ic1,ic2); - J(ir,kc2(ic3)) = fJ(:,kc1); -end -% w.r. exogenous variables -J(ir,nnz(i_leadlag1)+(1:exo_nbr)) = fJ(:,nnz(i_leadlag)+(1:exo_nbr)); - -% auxiliary variable for exogenous shocks -ir = 2*endo_nbr-instr_nbr+(1:exo_nbr); -kc = i_leadlag1(leadlag_nbr,endo_nbr+(1:exo_nbr)); -J(ir,kc) = eye(exo_nbr); -J(ir,nnz(i_leadlag1)+(1:exo_nbr)) = -eye(exo_nbr); - -% eliminating empty columns - -% getting indices of nonzero entries -m = find(i_leadlag1'); -n1 = max_lag1*endo_nbr1+1; -n2 = n1+endo_nbr-1; - - -n = length(m); -k = 1:size(J,2); - -for i=1:n - if sum(abs(J(:,i))) < 1e-8 - if m(i) < n1 || m(i) > n2 - k(i) = 0; - m(i) = 0; - end - end -end - -J = J(:,nonzeros(k)); -i_leadlag1 = zeros(size(i_leadlag1))'; -i_leadlag1(nonzeros(m)) = 1:nnz(m); -i_leadlag1 = i_leadlag1'; - -%eliminating lags in t-2 and leads in t+2, if possible -if all(i_leadlag1(5,:)==0) - i_leadlag1 = i_leadlag1(1:4,:); - max_lead1 = 1; -end - -if all(i_leadlag1(1,:)==0) - i_leadlag1 = i_leadlag1(2:4,:); - max_lag1 = 1; -end - -% setting expanded model parameters -% storing original values -M_.endo_nbr = endo_nbr1; -% Consider that there is no auxiliary variable, because otherwise it -% interacts badly with the auxiliary variables from the preprocessor. -M_.orig_endo_nbr = endo_nbr1; -M_.aux_vars = []; -M_.endo_names = endo_names1; -M_.lead_lag_incidence = i_leadlag1; -M_.maximum_lead = max_lead1; -M_.maximum_endo_lead = max_lead1; -M_.maximum_lag = max_lag1; -M_.maximum_endo_lag = max_lag1; -M_.orig_model = orig_model; - -if isfield(options_,'varobs') && (any(size(i_leadlag1,2) ~= size(old_lead_lag,2)) || any(any(i_leadlag1 ~= old_lead_lag))) - global bayestopt_ - dr = set_state_space(dr,M_); - nstatic = dr.nstatic; % Number of static variables. - npred = dr.npred; % Number of predetermined variables. - - var_obs_index = []; - k1 = []; - for i=1:size(options_.varobs,1); - var_obs_index = [var_obs_index strmatch(deblank(options_.varobs(i,:)),M_.endo_names(dr.order_var,:),'exact')]; - k1 = [k1 strmatch(deblank(options_.varobs(i,:)),M_.endo_names, 'exact')]; - end - % Define union of observed and state variables - k2 = union(var_obs_index',[nstatic+1:nstatic+npred]'); - % Set restrict_state to postion of observed + state variables in expanded state vector. - dr.restrict_var_list = k2; - [junk,ic] = intersect(k2,nstatic+(1:npred)'); - dr.restrict_columns = ic; - % set mf0 to positions of state variables in restricted state vector for likelihood computation. - [junk,bayestopt_.mf0] = ismember([dr.nstatic+1:dr.nstatic+dr.npred]',k2); - % Set mf1 to positions of observed variables in restricted state vector for likelihood computation. - [junk,bayestopt_.mf1] = ismember(var_obs_index,k2); - % Set mf2 to positions of observed variables in expanded state vector for filtering and smoothing. - bayestopt_.mf2 = var_obs_index; - bayestopt_.mfys = k1; - old_lead_lag = i_leadlag1; -end \ No newline at end of file diff --git a/matlab/dyn_ramsey_static_.m b/matlab/dyn_ramsey_static_.m index ea40de45a..6f4f40e48 100644 --- a/matlab/dyn_ramsey_static_.m +++ b/matlab/dyn_ramsey_static_.m @@ -35,9 +35,13 @@ global oo_ M_ % recovering usefull fields endo_nbr = M.endo_nbr; exo_nbr = M.exo_nbr; +orig_endo_nbr = M_.orig_endo_nbr; +orig_eq_nbr = M_.orig_eq_nbr; +inst_nbr = orig_endo_nbr - orig_eq_nbr; +% indices of Lagrange multipliers +i_mult = [orig_endo_nbr+(1:orig_eq_nbr)]'; +x = [x(1:orig_endo_nbr); zeros(orig_eq_nbr,1); x(orig_endo_nbr+1:end)]; fname = M.fname; -% inst_nbr = M.inst_nbr; -% i_endo_no_inst = M.endogenous_variables_without_instruments; max_lead = M.maximum_lead; max_lag = M.maximum_lag; beta = options_.planner_discount; @@ -75,47 +79,28 @@ if options_.steadystate_flag end end -oo_.steady_state = x; % value and Jacobian of objective function ex = zeros(1,M.exo_nbr); [U,Uy,Uyy] = feval([fname '_objective_static'],x(i_endo),ex, M_.params); Uy = Uy'; Uyy = reshape(Uyy,endo_nbr,endo_nbr); -y = repmat(x(i_endo),1,max_lag+max_lead+1); -% value and Jacobian of dynamic function -k = find(i_lag'); +% set multipliers to 0 to compute residuals it_ = 1; -% [f,fJ,fH] = feval([fname '_dynamic'],y(k),ex); -[f,fJ] = feval([fname '_dynamic'],y(k),[oo.exo_simul oo.exo_det_simul], ... - M_.params, x, it_); -% indices of Lagrange multipliers -inst_nbr = endo_nbr - size(f,1); -i_mult = [endo_nbr+1:2*endo_nbr-inst_nbr]'; +[f,fJ] = feval([fname '_static'],x,[oo.exo_simul oo.exo_det_simul], ... + M_.params); -% derivatives of Lagrangian with respect to endogenous variables -% res1 = Uy; -A = zeros(endo_nbr,endo_nbr-inst_nbr); -for i=1:max_lag+max_lead+1 - % select variables present in the model at a given lag - [junk,k1,k2] = find(i_lag(i,:)); - % res1(k1) = res1(k1) + beta^(max_lag-i+1)*fJ(:,k2)'*x(i_mult); - A(k1,:) = A(k1,:) + beta^(max_lag-i+1)*fJ(:,k2)'; -end +A = fJ(1:orig_endo_nbr,i_mult); +y = f(1:orig_endo_nbr); +mult = -A\y; -% i_inst = var_index(options_.olr_inst); -% k = setdiff(1:size(A,1),i_inst); -% mult = -A(k,:)\Uy(k); -mult = -A\Uy; -% resids = [f; Uy(i_inst)+A(i_inst,:)*mult]; -resids1 = Uy+A*mult; -% resids = [f; sqrt(resids1'*resids1/endo_nbr)]; -[q,r,e] = qr([A Uy]'); +resids1 = y+A*mult; +[q,r,e] = qr([A y]'); if options_.steadystate_flag - resids = [r(end,(endo_nbr-inst_nbr+1:end))']; + resids = [r(end,(orig_endo_nbr-inst_nbr+1:end))']; resids = resids1'*resids1; else - resids = [f; r(end,(endo_nbr-inst_nbr+1:end))']; + resids = [f(i_mult); r(end,(orig_endo_nbr-inst_nbr+1:end))']; end rJ = []; return; diff --git a/tests/optimal_policy/nk_ramsey.mod b/tests/optimal_policy/nk_ramsey.mod new file mode 100644 index 000000000..c83cccc5e --- /dev/null +++ b/tests/optimal_policy/nk_ramsey.mod @@ -0,0 +1,90 @@ +//MODEL: +//test on Dynare to find the lagrangean multipliers. +//We consider a standard NK model. We use the FOCS of the competitive economy and we aim at calculating the Ramsey optimal problem. + +//------------------------------------------------------------------------------------------------------------------------ +//1. Variable declaration +//------------------------------------------------------------------------------------------------------------------------ + +var pai, c, n, r, a; + +//4 variables + 1 shock + +varexo u; + + + + +//------------------------------------------------------------------------------------------------------------------------ +// 2. Parameter declaration and calibration +//------------------------------------------------------------------------------------------------------------------------- + +parameters beta, rho, epsilon, omega, phi, gamma; + +beta=0.99; +gamma=3; //Frish elasticity +omega=17; //price stickyness +epsilon=8; //elasticity for each variety of consumption +phi=1; //coefficient associated to labor effort disutility + +rho=0.95; //coefficient associated to productivity shock + + +//----------------------------------------------------------------------------------------------------------------------- +// 3. The model +//----------------------------------------------------------------------------------------------------------------------- + + +model; + + +a=rho*(a(-1))+u; + +1/c=beta*(1/(c(+1)))*(r/(pai(+1))); //euler + + +omega*pai*(pai-1)=beta*omega*(c/(c(+1)))*(pai(+1))*(pai(+1)-1)+epsilon*exp(a)*n*(c/exp(a)*phi*n^gamma-(epsilon-1)/epsilon); //NK pc +//pai*(pai-1)/c = beta*pai(+1)*(pai(+1)-1)/c(+1)+epsilon*phi*n^(gamma+1)/omega-exp(a)*n*(epsilon-1)/(omega*c); //NK pc + +(exp(a))*n=c+(omega/2)*((pai-1)^2); + +end; + +//-------------------------------------------------------------------------------------------------------------------------- +// 4. Steady state +//--------------------------------------------------------------------------------------------------------------------------- + +initval; + +pai=1; +r=1/beta; +c=0.9671684882; +n=0.9671684882; +a=0; + + +end; + + + +//--------------------------------------------------------------------------------------------------------------------------- +// 5. shocks +//--------------------------------------------------------------------------------------------------------------------------- + +shocks; +var u; stderr 0.008; + +end; + +//-------------------------------------------------------------------------------------------------------------------------- +// 6. Ramsey problem +//-------------------------------------------------------------------------------------------------------------------------- + +planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma))); + +write_latex_static_model; + +ramsey_policy(planner_discount=0.99); + + + diff --git a/tests/optimal_policy/ramsey.mod b/tests/optimal_policy/ramsey.mod index 3f85e551b..8f579d26a 100644 --- a/tests/optimal_policy/ramsey.mod +++ b/tests/optimal_policy/ramsey.mod @@ -26,4 +26,6 @@ end; planner_objective inflation^2 + lambda1*y^2 + lambda2*r^2; +write_latex_dynamic_model; + ramsey_policy(planner_discount=0.95, order = 1);