Hello all,

I recently got started using dynare. Currently, I am trying to replicate and simplified the Medina and Soto(2005) model. Now it seems that I have some problems with the number of the eigenvalues. I did also try to adjust the t period in the forward-looking equations, but it does not help. In addition, when I ran the model diagnostics test, it shows that there is a non-redundant equation missing. Can anybody here give me some suggestion ?

Thanks a lot in advance

Attached here is my code

```
/*
The following model follows a DSGE model developed by Medina and Soto(2005),
however this is the simplified version by excluding the Calvo pricing, Monetary Authority, and
the returns on investment.
*/
/*
ch = consumption of home goods
rer = real exchange rate
prh = nominal home-good price relative to consumption bundle price
c = total domestic consumption
cf = consumption of foreign goods
oc = oil consumption in domestic household
pro = nominal oil price relative to consumption bundle price
pi = domestic headline inflation
pih = domestic core inflation
oh = oil used in domestic production
l = labor
wr = nominal wage relative to consumption bundle price
yh = total home goods produced
ah = productivity/technology
prostar = nominal foreign oil price relative to consumption bundle(abroad)
psi = oil stabilization fund
deltae = nominal exchange rate(adjustment of the law of one price)
pistar = foreign inflation
cstar = total foreign consumption
y = domestic gdp
x = domestic export
m = domestic import
o = domestic oil
*/
var ch,rer,prh,c,cf,oc,pro,pi,pih,oh,l,wr,yh,ah,prostar,psi,deltae,pistar,cstar,y,x,m,o;
/*
gamma = share in core consumption
theta = intratemporal elasticity of substitution between home and foreign goods
eta = elasticity of substitution between oil and core consumption
B = discount factor
omega = elasticity of substitution between labor and oil in production
alpha = share of input in production
pa = AR product. shock
sigmaL = inverse elasticity of labor supply wrt. real wage
po = AR oil price shock
ppsi = AR oil fund shock
ppistar = AR foreign inflation shock
etastar = elasticity of substitution between oil and core consumption(foregin)
delta = share in domestic consumption
chyh = home goods consumption/home goods produced
cy = domestic consumption/GDP
xy = export/GDP
my = import/GDP
chstarx = foreign demand for home goods/export
pcstar = AR foreign consumption
cfm = domestic demand for foreign goods/import
oco = household oil consumption/total oil
oho = oil used in production/total oil
*/
varexo ea,eo,epsi,epistar,ecstar,
edeltae;
parameters gamma,theta,eta,B,omega,alpha,pa,sigmaL,po,ppsi,ppistar,etastar,delta,chyh,cy,xy,my,chstarx,pcstar,cfm,oco,oho,
pdeltae;
gamma = .075; // alp and elekdag
theta = .616; //medina and soto
eta = .656; //medina and soto
B = .9926; //Surach
omega = .507; //median and soto
alpha = .5;
pa = .936; //medina and soto
sigmaL = 3.0303; //Surach =1 in alp and elekdag
po = .88; //medina and soto
ppsi = .968; //medina and soto
ppistar = .140; //medina and soto
etastar = 1.14; //medina and soto =.508 alp and elekdag
delta = .5;
chyh = .8;
cy = .7;
xy = .12;
my = .18;
chstarx = 1; //in the case of Thailand
pcstar = .887; //medina and soto
cfm = .7;
oco = .5;
oho = .5;
pdeltae =.8; //Add//
Model(linear);
//Aggregate Demand//
//1 Domestic Consumption of Home goods
ch=(1-gamma)*(theta-eta)*rer-(theta*(1-gamma)+gamma*eta)*prh+c;
//2 Domestic Consumption of Foreign goods//
cf=-((theta*gamma)+eta*(1-gamma))*rer+gamma*(theta-eta)*prh+c;
//3: Domestic Consumption of Oil goods//
oc=(-eta*pro)+c;
//4: Euler Equation//
c=c(+1)+(-pi(+1));
//Aggregate Supply and Inflation//
//5: Passive Resetting price equation//
pih=(B*pih(+1));
//6: Optimal input//
oh-l=omega*(wr-pro);
//7: Production Funtion//
yh=ah+((1-alpha)*l)+alpha*oh;
//8: Technology process//
ah=pa*ah(-1)+ea;
//9: Marginal rate of substitution between labor and consumption//
wr=c+sigmaL*l;
//Relative Prices//
//10: Real price of home goods//
prh=prh(-1)+pih-pi;
//11: Real price of oil//
pro=rer+prostar+psi;
//12: The process of real price oil abroad with respect to foreign index AR(1)//
prostar=po*prostar(-1)+eo;
//13: The deviation from law of one price -> the oil stabilization fund//
psi=ppsi*psi(-1)+epsi;
//14: Real Exchange Rate//
rer=rer(-1)+deltae+pistar-pi;
//15: Foregin Inflation rate AR(1)//
pistar=ppistar*pistar(-1)+epistar;
//16: The relation among the real pice of oil, the real price of Home goods, and the real exchange rate//
0=delta*pro+((1-delta)*gamma*prh)+(1-delta)*(1-gamma)*rer;
//Aggregate Equilibrium//
//17: Market Clearing Condition for Home Good Sector//
yh=chyh*ch+(1-chyh)*cstar-etastar*(1-chyh)*(prh-rer);
//18: Total GDP//
y=cy*c+xy*x-my*m;
//19: Total Export//
x=-etastar*(chstarx)*(prh-rer)+chstarx*cstar;
//20: Foreign Consumption Ar(1);
cstar=pcstar*cstar(-1)+ecstar;
//21: Total Import//
m=(cfm)*cf+(1-cfm)*o;
//22: Total Oil//
o=(oco*oc)+(oho*oh);
//Added: not sure if it is right to add this//
deltae=pdeltae*(deltae(-1))+edeltae;
end;
initval;
ch = 0;
rer = 0;
prh = 0;
c = 0;
cf = 0;
oc = 0;
pro = 0;
pi = 0;
pih = 0;
oh = 0;
l = 0;
wr = 0;
yh = 0;
ah = 0;
prostar = 0;
psi = 0;
deltae = 0;
pistar = 0;
cstar = 0;
y = 0;
x = 0;
m = 0;
o = 0;
end;
steady;
check;
shocks;
var ea; stderr 3.019 ; //medina and soto
var eo; stderr .134; //medina and soto
var epsi; stderr 5.376; //medina and soto
var epistar; stderr 1.167; //medina and soto
var ecstar; stderr 4.659; //medina and soto
var edeltae; stderr .018;
end;
model_diagnostics;
//stoch_simul;
```