Page 1 of 1

Error too many inputs

PostPosted: Fri Nov 21, 2014 10:18 am
by mgali
Okay so I am running the following code for Chapter 09 of ABCs of RBCs. But I am getting the message:

??? Error using ==> var
Too many input arguments.

Error in ==> mgafri2 at 6
var y c k r h w m p la g;

Am completely new to MATLAB and dynare. I installed dynare and added it to path.

My code is:

%Macroeconomics Theory III: Money in Utility
%Mehwish Ghulam Ali and Sana Tauseef
addpath c:\dynare\4.4.3\matlab
%-------------------
%%Defining Variables
%-------------------
var y c k r h w m p la g;
varexo e1 e2;
%shocks e1 is error in lambda and e2 is error in g
%la is lambda
parameter beta delta theta bb gbar dd gamma sde1 sde2;
parameters R C_MP;
%------------
%%calibration
%------------
%Technology
theta=.36;
delta=.025;
gamma=.95;
sde1=.007;
sde2=.007;
%Preferences
beta=0.99;
%Steady state values
R=1/beta;
g=1;
bb=-2.5805;
dd=.01;
pie=.48;
gbar=g;
%Steady State equations
rbar=R-(1-delta);
wbar=(1-theta)*(theta/rbar)^(theta/(1-theta));
cbar=-wbar*R;
mpbar=(dd*gbar*cbar)/(gbar-beta);
Q=(rbar*(1-theta)/wbar*theta);
kbar=cbar/(Q^(1-theta)-delta);
ybar=kbar*Q^(1-theta);
hbar=Q*kbar;
S=(beta/gbar)+mpbar;
C_MP=(gbar-beta)/(dd*gbar);
%------
%%Model
%------
model(linear);
p=(-1/S)*(c-(beta/gbar)*c(+1)-(beta/gbar)*p(+1)-C_MP*m);
c=-beta*r(+1)+beta*(rbar+1-delta)*w(+1);
w=c;
h=(1/(wbar*hbar))*(cbar*c+kbar*k(+1)-wbar*hbar*w-rbar*kbar*r-(rbar+1-delta)*kbar*k);
k=(1/theta)*(w-la-theta*h);
y=la+theta*k+(1-theta)*h;
r=la+(theta-1)*k+(1-theta)*h;
m=g+m(-1);
la=gamma*la(-1)+e1;
g=gamma*g(-1)+e2;
%------------
%%Computation
%------------
initval;
p=0;
c=0;
w=0;
h=0;
k=0;
y=0;
r=0;
m=0;
la=0;
g=0;
shocks;
var e1= sde1^2;
var e2= sde2^2;
steady;
stoch_simul;

Re: Error too many inputs

PostPosted: Fri Nov 21, 2014 3:10 pm
by jpfeifer
Please see the manual on how to call Dynare. You currently wrote your mod-file into a Matlab m-file and try to run this. You must save the text-file as a .mod-file and then run
Code: Select all
dynare yourmodfile.mo