Need to modifying dynare code

  1. In the model incorporating New Keynesian features, household heterogeneity evolves according to an AR(1) process for labor productivity.
  2. “The model includes a Taylor rule for the central bank, intermediate and final goods production, and incorporates price stickiness that gives rise to markups.”
    3.“Following a TFP shock (positive or negative), the government acts as a Ramsey planner, making decisions that maximize social welfare. Policy instruments include taxes, government spending, transfers, public debt, and the interest rate determined by the Taylor rule, alongside the macroeconomic responses.”

The code appears correct as written below, but it keeps generating an unknown error.

( 다음 사용 중 오류가 발생함: [print_info](matlab:matlab.lang.internal.introspective.errorDocCallback(‘print_info’, ‘C:\dynare\6.3\matlab\print_info.m’, 33)) ([33번 라인](matlab: opentoline(‘C:\dynare\6.3\matlab\print_info.m’,33,0)))
Ramsey: The steady state computation resulted in NaN in the auxiliary equations
for optimal policy)

// HANK-type DSGE with Investment Adjustment Costs and Ramsey Policy

var C K B R T G TR A Y N w r MC I P inv_ratio adj_cost;  
varexo eps_A eps_N;                 // TFP 충격 노동생산성 충격

parameters beta sigma delta rho_A rho_N alpha phi epsilon mu;

// Parameters
beta    = 0.98;
sigma   = 1.4;
delta   = 0.1;
rho_A   = 0.95;
rho_N   = 0.95;
alpha   = 0.36;
phi     = 10.0;      // 조정비용 계수
epsilon = 6.0;

mu = epsilon / (epsilon - 1);

// ------------------------------
// 모형
// ------------------------------
model;

// 생산함수 (도매기업) 1
Y = A * K^alpha * N^(1 - alpha);

// 한계비용 → 가격 → 마크업 2, 3
MC = w^(1 - alpha) * r^alpha / A;
P = mu * MC;

// 요소 가격 4, 5
w = (1 - alpha) * Y / N;
r = alpha * Y / K;

// Euler 방정식 6
1 / (C^sigma) = beta * (1 + R(+1)) / (C(+1)^sigma);

// 조정비용 관련 정의 7, 8
inv_ratio = I / I(-1);
adj_cost = (phi / 2) * (inv_ratio - 1)^2;

// 자본축적식 (조정비용 포함) 9
K = (1 - delta) * K(-1) + I * (1 - adj_cost);

// 예산 제약식 10
C = T * (w * N + r * K) + TR + (R - 1) * B / P - I;

// 정부 예산제약 11
G = T * (w * N + r * K) + (R - 1) * B / P - TR;

// TFP shock 12
log(A) = rho_A * log(A(-1)) + eps_A;

// 노동생산성 shock 13
log(N) = rho_N * log(N(-1)) + eps_N;

end;

steady_state_model;
  A = 1;
  N = 1;

  //r = 1/beta - 1 + delta;
  r=0.05;
  beta = 0.98;            // r 먼저
  K = (alpha * A / r)^(1 / (1 - alpha)) * N; // 임금 공식과 결합해서 K 추정
  Y = A * K^(alpha) * N^(1 - alpha);  // 생산함수
  w = (1 - alpha) * Y / N;
  MC = w^(1 - alpha) * r^alpha / A;
  P = mu * MC;
 
  I = delta * K;
  C = T * (w * N + r * K) + TR + (R - 1) * B / P - I;
  //C = 1.5;
  TR = 0.3;

  inv_ratio = 1;
  adj_cost = 0;

 B = 0.45;

 R = 1/beta - 1;

 G = T * (w * N + r * K) + (R - 1) * B / P - TR;
 //G = 0.6;
   //T = ((1 + R) * B / P - TR - G) / (w * N + r * K);
 T = 0.2;
end;
// ------------------------------
// 초기값 및 충격
// ------------------------------
initval;

 A = 1;
  N = 0.5;
  K = 10;
  I = 0.25;
  C = T * (w * N + r * K) + TR + (R - 1) * B / P - I;
  Y = 3;
  B = 0.45;

  R = 1/beta - 1;  

G = T * (w * N + r * K) + (R - 1) * B / P - TR;
//G=0.6;
  TR = 0.3;
  //T = ((1 + R) * B / P - TR - G) / (w * N + r * K);
T=0.2;  
w = 0.5;
  r = 0.05;
  MC = 1;
  P = mu;
  inv_ratio = 1;
  adj_cost = 0;

end;

shocks;
var eps_A; stderr 0.01;
var eps_N; stderr 0.01;
end;

// ---- 복지최적화 설정 ----
steady;
ramsey_model(planner_discount=0.99);

planner_objective (C^(1 - sigma) - 1)/(1 - sigma);

// ---- 정책 도구 지정 ----
 instruments G ;

// ---- 시뮬레이션 실행 ----
stoch_simul(order=2, irf=100);
  1. You missed the warning

Warning: Either you have not correctly initialized planner_discount or you are calling a command like steady or stoch_simul that is not allowed in the context of ramsey_policy

  1. After you move the command in the proper order, Dynare is not able to find a steady state. That may well be because your instrument G_t is chosen by the Ramsey planner, but you are currently assigning a steady state value in the steady_state_model block. You should have a proper conditional steady state, i.e. starting from a given value for G.