# Error using ==\> dynare

**URL:** <https://forum.dynare.org/t/error-using-dynare/1630>\
**Category:** Dynare help (legacy posts)\
**Created:** [30 August 2010 10:23 UTC](https://forum.dynare.org/t/error-using-dynare/1630 "2010-08-30T10:23:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zubin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/2acd7d/32.png) [@zubin](https://forum.dynare.org/u/zubin)\
**Post date:** [30 August 2010 10:23 UTC](https://forum.dynare.org/t/error-using-dynare/1630/1 "2010-08-30T10:23:49Z")

</div>

Hi:

Recently I am working on a two-country open economy model, combining BGG(1999) and Obstfeld & Rogoff(1995). I assume the home country’s currency is pegged to the foreign country’s, and in each period, a fixed portion of foreign net worth enters home country as FDI, but the short-term foreign debt, as well as other forms short-term capital flows are forbidden in the home country. Therefore, since home country’s currency is pegged, it has to use money base to balance its current account and FDI account to stabilize the exchange rate.  
As a beginner of Dynare, I found that the following problems keeps showing in my Matlab after I fed Dynare the parameter value and F.O.Cs of the model.  
I hope someone will help debug my Dynare programme here(when I write this programme I refer to the BGG programme a lot, see atachment). My model’s F.O.Cs are also presented in the attachment.Thanks !

My programme starts:

// Bin Zhu  
// Aug 10  
// intial: rU is rU(-1);kU is kU(-1)

// BGG and FDI open economy model, code for Dynare  
// assume flexible price  
// variablenamef is the foreign counterpart

var y\_w , e, rs, t\_U; // involve both countries;tU is trade balance of home country; rs is foreign reserve of home country; y\_w is world output  
var cU , i , mo, k , q ,y, yh, x, ph, h , p, pi , r , n , ce , rk , efp , aU, gU, m; // for home country; mo is monitoring cost  
var cfU , i\_f , mof, kf , qf , yf, yhf, xf, phf, hf , pf, pif , rf , nf , cef , rkf , efpf , af, gf, mf; // for foreign country  
varexo e\_gU, e\_aU, ksi, e\_gf, e\_af, ksif;

parameters epsl,TB\_F,FDI\_F,v,mkup,E,Rg;  
parameters CY\_w,CeY\_w,IY\_w,GY\_w,MoY\_w,kn,yn,Rk,beta,eta,ita,zeta,alphaK,delta,phi,omega,gamma,psiz,GDP\_TB,nomC\_TB,nomI\_TB,nomG\_TB,nomCe\_TB,nomMo\_TB; // for home country  
parameters CY\_wf,CeY\_wf,IY\_wf,GY\_wf,MoY\_wf,knf,ynf,Rkf,betaf,etaf,itaf,zetaf,alphaKf,deltaf,phif,omegaf,vf,gammaf,psizf; // for foreign country

epsl = 0.957593537 ; //degree of substitution, the more the larger  
TB\_F = 0.78 ; // ratio of trade balance trend and foreign reserve trend for home country  
FDI\_F = 0.22 ; // ratio of net FDI trend and foreign reserve trend  
mkup = 1.1 ; //%X: steady state value  
v = 0.2;//proportion of FDI  
E = 1;//steady state value of exchange rate  
Rg = 0.03;//nominal net interest rate of foreign government bond  
CY\_w = 0.1 ; CY\_wf = 0.2;// nC/Y\_w: long-term trend of national consumption share of world demand  
CeY\_w = 0.005 ; CeY\_wf = 0.005 ;// nCe/Y\_w  
IY\_w = 0.184229809 ; IY\_wf = 0.184229809;// nI/Y\_w  
GY\_w = 0.2 ; GY\_wf = 0.1;// nG/Y\_w  
MoY\_w = 0.015 ; MoY\_wf = 0.015;// nMo/Y\_w  
kn = 1.081759973 ; knf = 2.081759973;//K/N: economic-wide leverage rate  
yn = 0.3 ; ynf = 0.282494996 ;//%Y/N: ratio of output and net worth  
Rk = 2.018177298 ; Rkf = 1.018177298 ;//expected gross return of one unit physical capital  
beta = 0.99 ; betaf = 0.99;//calibrated by risk-free interest rate  
eta = 2.89 ; etaf = 3;//steady state value of the ratio of leisure hours over working hours  
ita = 0.052092347 ; itaf = 0.052092347;//coefficient in loan demand equation  
zeta = 0.9576 ; zetaf = 0.9576; //coefficient in capital demand equation  
alphaK = 0.4 ; alphaKf = 0.35;//capital share in wholesale goods production  
delta = 0.03 ; deltaf = 0.025 ;//capital depreciation rate  
phi = 0.25 ; phif = 0.25;//coefficient in investment demand equation  
omega = 0.97; omegaf = 0.984615;//ordinary worker’s labor share in entire labor input  
gamma = 0.9728 ; gammaf = 0.9728;//survival rate of entrepreneurs  
psiz = 0.996; psizf = 0.996;//autoregressive coefficien of technology shock  
GDP\_TB = 12; // nominal GDP over nominal trade balance for home country  
nomC\_TB = 4.48;  
nomI\_TB = 5.97;  
nomG\_TB = 1.634;  
nomCe\_TB = 1;  
nomMo\_TB = 1.05;

R = 1/beta ; Rf = 1/betaf;

model;  
mo = rk + q(-1) + k; //definition of mo  
mof = rkf + qf(-1) + kf; //definition of mof  
y\_w = (CY\_w_cU + CY\_wf_cfU) + (IY\_w_i + IY\_wf_i\_f) + (GY\_w_gU + GY\_wf_gf) + (CeY\_w_ce + CeY\_wf_cef) + (MoY\_w_mo + MoY\_wf_mof); //aggregate demand  
cU = -r + cU(+1); [//4.15](https://4.15) Euler equation  
cfU = -rf + cfU(+1); [//4.15](https://4.15)\*  
ce = n; [//4.16](https://4.16) entrepreneurs’ demand  
cef = nf; [//4.16](https://4.16)\*  
m - p = -cU - beta/(1-beta)_r(+1) + beta/(1-beta)pi(+1); //money demand  
mf - pf = -cfU - betaf/(1-betaf)rf(+1) + betaf/(1-betaf)pif(+1); //money demand  
pi = p - p(-1); //definition of inflation  
pif = pf - pf(-1);  
efp = rk(+1) - r; //definition of premium  
efpf = rkf(+1) - rf; //definition of premium  
rk(+1) - r = -ita(n-q-k); [//4.17](https://4.17) loan demand  
rkf(+1) - rf = -itaf(nf-qf-kf); [//4.17](https://4.17)_  
rk = (1-zeta)_(y-k(-1)-x) + zeta_q - q(-1); [//4.18](https://4.18) capital demand  
rkf = (1-zetaf)_(yf-kf(-1)-xf) + zetaf_qf - qf(-1); [//4.18](https://4.18)\*  
q = phi\*(i-k(-1)); [//4.19](https://4.19) investment demand  
qf = phif\*(i\_f-kf(-1)); [//4.19](https://4.19)\*  
y = aU + alphaK_k(-1)+(1-alphaK)omegah; [//4.20](https://4.20) wholesale goods supply  
yf = af + alphaKf_kf(-1)+(1-alphaKf)_omegaf_hf; [//4.20](https://4.20)\*  
yh = -epsl\*(ph - p) + y\_w; //diversified product supply  
yhf = -epsl\*(phf - pf) + y\_w; //  
yh = y;  
yhf = yf;  
y - h - x - cU = eta^(-1)_h; [//4.21](https://4.21) labor market equilibrium  
yf - hf - xf - cfU = etaf^(-1)hf; [//4.21](https://4.21)  
p = n_ph + (1-n)_(e + phf) ;//price evolution  
pf = n_(ph-e) + (1-n)_phf ;  
ph = p - x ;//optimal price setting  
phf = ph - xf ;  
m - m(-1) = e + (rs - rs(-1)) + ksi; // money supply  
mf - mf(-1) = ksif;  
e = 0; // fixed exchange rate regime  
k = delta_i + (1-delta)_k(-1); [//4.23](https://4.23) capital formation  
kf = deltaf_i\_f + (1-deltaf)_kf(-1); [//4.23](https://4.23)_  
n = gamma/beta_n(-1) + ((gamma/beta)-((gamma_kn)/beta))_r + ((gamma_kn)/beta+((gamma_kn)_(Rk-(1/beta))))_rk +((gamma_kn)_(Rk-(1/beta)))q(-1) + ((gammakn)_(Rk-(1/beta)))_k + ((1-alphaK)_(1-omega)_yn/mkup)_(y-x) + v_E_nf; [//4.24](https://4.24) net worth evolution  
nf = (1-v)_gammaf/betaf_nf(-1) + ((1-v)_(gammaf/betaf)-((gammaf_knf)/betaf))_rf + ((gammaf_knf)/betaf+((gammaf_knf)_(Rkf-(1/betaf))))_rkf +((gammaf_knf)_(Rkf-(1/betaf)))qf(-1) + ((gammafknf)_(Rkf-(1/betaf)))_kf + ((1-alphaKf)_(1-omegaf)_ynf/mkup)_(yf-xf); [//4.24](https://4.24)  
rs = (1+Rg)_rs(-1) + TB\_F_t\_U + FDI\_F\*(nf + pf + e) // foreign reserve  
t\_U = GDP\_TB\*(epsl_p + y\_w + (1-epsl)ph) - nomC\_TB(p+cU) - nomI\_TB_(p+i) - nomG\_TB\*(p+gU) - nomCe\_TB\*(p+ce) - nomMo\_TB\*(p+mo);  
gU = 0.95_gU(-1) + e\_gU; //government purchase shock process, 4.26  
gf = 0.95_gf(-1) + e\_gf; //government purchase shock process, 4.26\*  
aU = psiz_aU(-1) + e\_aU; [//4.27](https://4.27) technology shock  
af = psizf_af(-1) + e\_af; [//4.27](https://4.27)\*  
end;

//initval;

//end;

shocks;  
var e\_gU; stderr 0.0155;  
//var e\_gU; stderr 0;  
var e\_aU; stderr 0.0043;  
//var e\_aU; stderr 0;  
var ksi;stderr 0.06;  
var e\_gf; stderr 0.0155;  
//var e\_gf; stderr 0;  
var e\_af; stderr 0.0043;  
//var e\_af; stderr 0;  
var ksif;stderr 0.06;  
end;

steady(solve\_algo=2);  
check;

stoch\_simul(order=1,irf=20) y cU i efp n rn pi r rk yf cfU i\_f efpf nf rnf pif rf rkf;

Matlab result:

Starting Dynare (version 4.1.2).  
Starting preprocessing of the model file …  
ERROR: Untitled3.mod:94.1-3: syntax error, unexpected NAME

??? Error using ==\> dynare  
DYNARE: preprocessing failed  
[FOC.pdf](https://forum.dynare.org/uploads/default/original/1X/b250c78ff8eb64448542451ba3025836167542c5.pdf) (89.1 KB)  
[FDI.mod](https://forum.dynare.org/uploads/default/original/1X/d8720f34d1e77054faab44dda9831f5e2f6cc744.mod) (5.81 KB)  
[BGG.mod](https://forum.dynare.org/uploads/default/original/1X/904de0c34009a4c19892b3d5b7dcc4f663c90dc2.mod) (2.13 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [30 August 2010 11:45 UTC](https://forum.dynare.org/t/error-using-dynare/1630/2 "2010-08-30T11:45:18Z")

</div>

There is a semicolon missing in line 93.

---

<div class="post-metadata">

**Author:** ![zubin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/2acd7d/32.png) [@zubin](https://forum.dynare.org/u/zubin)\
**Post date:** [30 August 2010 14:20 UTC](https://forum.dynare.org/t/error-using-dynare/1630/3 "2010-08-30T14:20:32Z")

</div>

Thanks a lot! Now my programmme can be preprocessed.
