Page 1 of 1

Declare endogenous variables ...

PostPosted: Mon Apr 22, 2013 4:40 pm
by MSD
Hi,
I am a new user of dynare. When I want to run a program it crashes! The message is as follows:

You did not declare endogenous variables after the estimation/calib_smoother command.
Undefined function 'gaminv' for input arguments of type 'double'.

Error in draw_prior_density (line 72)
infbound = 1/sqrt(gaminv(1-10*truncprior, p7(indx)/2, 2/p6(indx)))+p3(indx);

Error in plot_priors (line 55)
[x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_);

Error in dynare_estimation_init (line 127)
plot_priors(bayestopt_,M_,estim_params_,options_)

Error in dynare_estimation_1 (line 59)
[dataset_,xparam1, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_,
bayestopt_);

Error in dynare_estimation (line 70)
dynare_estimation_1(var_list,dname);

Error in AP2 (line 141)
dynare_estimation(var_list_);

Error in dynare (line 120)
evalin('base',fname) ;

Can anybody help me please?
>>

Re: Declare endogenous variables ...

PostPosted: Mon Apr 22, 2013 8:57 pm
by jpfeifer
There seems to be a path issue. Matlab does not find the gaminv function, but it should be located in the matlab\missing\stats folder of your Dynare installation.

Re: Declare endogenous variables ...

PostPosted: Tue Apr 23, 2013 5:28 pm
by MSD
Thank you for your answer! But I do not think the problem is about the path.
I have added the folder "c:/dynare/4.3.3/matlab" and saved it in "set path" command, also in the command window I typed the correct path. Maybe the problem is related to how I've written the model! Could anybody help at all please?!
This is the model:

periods 1000;
var c k lab z;
varexo e;
parameters bet del alp rho the tau s;
bet = 0.987;
the = 0.357;
del = 0.012;
alp = 0.4;
tau = 2;
rho = 0.95;
s = 0.007;
model;
(c^the*(1-lab)^(1-the))^(1-tau)/c = bet*((c(+1)^the*(1-lab(+1))^(1-the))^(1-tau)/c(+1))*(1+alp*exp(z(-1))*k(-1)^(alp-1)*lab^(1-alp)-del);
c=the/(1-the)*(1-alp)*exp(z(-1))*k(-1)^alp*lab^(-alp)*(1-lab);
k=exp(z(-1))*k(-1)^alp*lab*(1-alp)-c+(1-del)*k(-1);
z=rho*z(-1)+s*e;
end;
initval;
k = 1;
c = 1;
lab = 0.3;
z = 0;
e = 0;
end;
shocks;
var e;
stderr 1;
end;
steady;
check;
estimated_params;
stderr e,inv_gamma_pdf, 0.95,inf;
rho,beta_pdf,0.93,0.02;
the,normal_pdf,0.3,0.05;
tau,normal_pdf,2.1,0.3;
end;
var c k lab z;
varobs c;
estimation(datafile=simudata, mh_replic=10000);

Re: Declare endogenous variables ...

PostPosted: Wed Apr 24, 2013 6:37 am
by jpfeifer
It perfectly runs on my machine. Try adding not only the mablab folder but also explicitly the subfolder matlab\missing\stats

Re: Declare endogenous variables ...

PostPosted: Thu Apr 25, 2013 8:07 am
by MSD
Many thanks for your reply. It works, but not completely! I could manage to get the first graph but not the second. The message is as follows:

You did not declare endogenous variables after the estimation/calib_smoother command.
Error using read_variables (line 58)
Can't find datafile: simudata.{m,mat,xls,xlsx}
Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,[],xls.sheet,xls.range);
Error in dynare_estimation_init (line 347)
dataset_ =
initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);
Error in dynare_estimation_1 (line 59)
[dataset_,xparam1, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_,
bayestopt_);
Error in dynare_estimation (line 70)
dynare_estimation_1(var_list,dname);
Error in AP2 (line 141)
dynare_estimation(var_list_);
Error in dynare (line 120)
evalin('base',fname) ;