An estimated NK model for Viet Nam
In this note, we are going to apply a canonical New Keynesian model on the Vietnamese economy.
See here for more: (https://callumjones.github.io/files/dynare_man.pdf#page=15.79)
Model
The economy is closed. The building blocks of the model follows Ireland (2004, RES). Endogenous variables include $y, x, g, r, \pi, a, e, z$, which are real output, output gap, output growth, interest rate, inflation rate, preference shocks, cost-push shocks, and technological shocks.
(Note that $e$ is a cost-push shocks to firms’ desired markup. With price adjustment costs, it may differ in the short-run but tend to move towards the desired markup over time.)
The IS curve
\[\hat{x}_t = E_t \hat{x}_{t+1} - (\hat{r} - E_t \hat{\pi}_{t+1}) + (1-\omega)(1-\rho_a) \hat{a}_t\]The Phillips Curve
\[\hat{\pi}_t = \beta E_t \hat{\pi}_{t+1} + \psi \hat{x}_t - e_t\]The Taylor rule
\[\hat{r}_t = \hat{r}_{t-1} + \rho_\pi \hat{\pi}_t + \rho_g \hat{g}_t + \rho_x \hat{x}_t - \epsilon_{r,t}\]Some identities:
\[\hat{x}_t = \hat{y}_t - \omega \hat{a}_t, \\ \hat{g}_t = \hat{y}_t - \hat{y}_{t-1} + \hat{z}_t, \\ \hat{a}_t = \rho_a \hat{a}_{t-1} + \epsilon_{a,t}, \\ \hat{e}_t = \rho_e \hat{e}_{t-1} + \epsilon_{e,t}, \\ \hat{z}_t = \epsilon_{z,t}\]The model is linear and all variables (hat) are expressed in log difference from the steady state.
Dynare Implementation
/*
* This file estimates the New Keynesian model of Peter Ireland (2004).
*/
// Endogenous variables
var y ${y}$ (long_name='real output')
x ${x}$ (long_name='output gap')
g ${g}$ (long_name='output growth')
r ${r}$ (long_name='interest rate')
pi ${\pi}$ (long_name='inflation')
a ${a}$ (long_name='preference shock')
e ${e}$ (long_name='cost-push shock')
z ${z}$ (long_name='tech shock')
;
varexo eps_r, eps_a, eps_e, eps_z ;
// using growth rates, inflation, and interest rates as observed variables
varobs g pi r;
// Parameters
parameters beta, omega, psi, rho_pi, rho_g, rho_x, rho_a, rho_e,
sig_r, sig_z, sig_a, sig_e ;
// Parameter values
beta = 0.99 ;
psi = 0.1 ;
omega = 0.0617 ;
rho_pi = 1.5 ;
rho_g = 0.1 ;
rho_x = 0.3 ;
rho_a = 0.9470 ;
rho_e = 0.9625 ;
sig_a = 0.0405 ;
sig_e = 0.0012 ;
sig_z = 0.0109 ;
sig_r = 0.0031 ;
// Model equations
model(linear);
// IS curve
x = x(+1) - (r - pi(+1)) + (1 - omega) * (1 - rho_a) * a ;
// Phillips curve
pi = beta * pi(+1) + psi * x - e ;
// Taylor rule with interest rate smoothing
r = r(-1) + rho_pi * pi + rho_g * g + rho_x * x + eps_r ;
// Output gap definition
x = y - omega * a ;
// Output growth definition
g = y - y(-1) + z ;
// Shock processes
a = rho_a * a(-1) + eps_a ;
e = rho_e * e(-1) + eps_e ;
z = eps_z ;
end;
steady;
check;
// Bayesian Estimation with informative priors
estimated_params ;
rho_a, beta_pdf, 0.9, 0.05 ;
rho_e, beta_pdf, 0.9, 0.05 ;
omega, normal_pdf, 0.1, 0.05 ;
// Monetary policy coefficients (Taylor rule)
// rho_pi: typically > 1 for stability (Taylor principle)
rho_pi, normal_pdf, 1.5, 0.05 ;
// rho_g and rho_x: typically small positive values
rho_g, normal_pdf, 0.1, 0.05 ;
rho_x, normal_pdf, 0.1, 0.05 ;
// Shock standard deviations (inverse gamma priors)
// Inverse gamma: shape parameter controls tail thickness
// First parameter: mode (approximately), second: degrees of freedom
stderr eps_a, inv_gamma_pdf, 0.1, 2 ;
stderr eps_e, inv_gamma_pdf, 0.01, 2 ;
stderr eps_z, inv_gamma_pdf, 0.01, 2 ;
stderr eps_r, inv_gamma_pdf, 0.01, 2 ;
end;
// Bayesian estimation
// mh_replic=0: Only find mode and compute posterior moments via Laplace approximation (fast)
// To run full MCMC, set mh_replic to a positive number (e.g., 20000)
// and optionally add: mh_nblocks=2, mh_jscale=0.2, mh_drop=0.5
estimation(datafile=data, mode_compute=6, mh_replic=0);
if we want to use the model to forecasts, replace the last line with
estimation(datafile=data, mode_compute=6, mh_replic=0, forecast=8, smoother) x g pi r;
The data I used is stored in data.csv where it contains the observed q-o-q GDP growth, q-o-q inflation, and interest rates. The series are obtained from NSO and IMF’s IFS from 2010Q1 to 2025Q4 (about 64 observations). Then, I used IRIS Toolbox to seasonal adjust GDP and inflation with the X13-ARIMA-SEATS program.
You can download the adjusted dataset here.
Here is the estimation results
RESULTS FROM POSTERIOR ESTIMATION
parameters
prior mean mode s.d. prior pstdev
psi 0.1000 0.2032 0.0440 norm 0.0500
omega 0.1000 0.1010 0.0529 norm 0.0500
rho_a 0.9000 0.9346 0.0429 beta 0.0500
rho_e 0.9000 0.9430 0.0294 beta 0.0500
rho_pi 1.5000 1.3836 0.0515 norm 0.0500
rho_g 0.1000 0.2092 0.0470 norm 0.0500
rho_x 0.1000 0.2977 0.0282 norm 0.0500
standard deviation of shocks
prior mean mode s.d. prior pstdev
eps_a 0.1000 0.0425 0.0234 invg 2.0000
eps_e 0.0100 0.0237 0.0043 invg 2.0000
eps_z 0.0100 0.1083 0.0106 invg 2.0000
eps_r 0.0100 0.0445 0.0049 invg 2.0000
THEORETICAL MOMENTS
VARIABLE MEAN STD. DEV. VARIANCE
y 0.0000 0.2046 0.0419
x 0.0000 0.2042 0.0417
g 0.0000 0.1129 0.0127
r 0.0000 0.0498 0.0025
pi 0.0000 0.0492 0.0024
a 0.0000 0.1138 0.0130
e 0.0000 0.0460 0.0021
z 0.0000 0.1104 0.0122
