RegardingERROR: GHH.mod:59.1: syntax error, unexpected NAME

Dear Sir/Madam,

I was wondering if you could please assist me with the error message I am having below.

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//% Notes:
//% DYNARE timing convention has been used
//% for the capital accumulation equation

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//% VARIABLES AND PARAMETERS DEFINITION
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var y c k i h l z;
varexo e;

parameters beta alpha gamma theta omega rho sigma;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//% CALIBRATED PARAMETER VALUES FROM THE ARTICLE
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
beta = .96;
alpha = .29;
gamma= 2;
theta = .6;
omega= 1.42;
rho=.51;
sigma = .045;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//% MODEL:
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

model;

//% FIRST ORDER CONDITIONS

exp(l)=((1-alpha)(exp(k(-1))(exp(h))^alpha)exp(l)^(-alpha))^(1/theta);
exp(h)=((alpha
(exp(k(-1)exp(h))^(alpha-1))exp(l)^(1-alpha))(1+exp(z)))^(1/omega-1);
((exp©-(exp(l)^1+theta)/(1+theta))^(-gamma))/(1+exp(z))=beta
(exp(c(+1))-(exp(l(+1))^(1+theta))/(1+theta)^(-gamma))alpha(exp(k)exp(h(+1))^(alpha-1))(exp(l(+1))^(1-alpha))*exp(h(+1))+(1-(1/omega)*exp(h(+1))^omega)/(1+exp(z(+1)));
((exp(k(-1))*exp(h))^alpha)exp(l)^(1-alpha)=exp©+exp(k)/(1+exp(z))-(exp(k(-1))(1-(1/omega)*exp(h)^omega))/(1+exp(z));

//% CONSTRAINTS

exp(k)=(((exp(k(-1))^alpha)(exp(h))^(alpha))exp(l)^(1-alpha)+(1-(1/omega)(exp(h)^omega)exp(k(-1)))/(1+exp(z))-exp©)(1+exp(z));
exp(y)=exp©+exp(i)/(1+exp(z));
z=rho
z(-1)+e;

end;

//% INITIAL VALUES AND STEADY STATE:
initval;
k=0.567966;
i=0.0563;
l=0.3610;
h=0.251526;
c=0.2196
z=0;
e=0;
end;

steady;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//% SHOCKS: DEFINE SHOCKS
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

shocks;
var e = sigma^2;
end;

stoch_simul(periods=2100,order=1);

The message I get is:

dynare GHH.mod

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

Starting Dynare (version 4.1.2).
Starting preprocessing of the model file …
ERROR: GHH.mod:59.1: syntax error, unexpected NAME

??? Error using ==> dynare at 126
DYNARE: preprocessing failed

Thank you so much.

Regards,
Bouba

There was a semicolon missing after c=0.2196. Moreover, there are some problems with the uncommented line like /%%%.

Moreover, the steady state initial values are wrong. But at least this version runs up to SS computation.

[code]//% Notes:
//% DYNARE timing convention has been used
//% for the capital accumulation equation

//% VARIABLES AND PARAMETERS DEFINITION
var y c k i h l z;
varexo e;

parameters beta alpha gamma theta omega rho sigma;

//% CALIBRATED PARAMETER VALUES FROM THE ARTICLE
beta = .96;
alpha = .29;
gamma= 2;
theta = .6;
omega= 1.42;
rho=.51;
sigma = .045;

//% MODEL:

model;

//% FIRST ORDER CONDITIONS

exp(l)=((1-alpha)(exp(k(-1))(exp(h))^alpha)exp(l)^(-alpha))^(1/theta);
exp(h)=((alpha
(exp(k(-1)exp(h))^(alpha-1))exp(l)^(1-alpha))(1+exp(z)))^(1/omega-1);
((exp©-(exp(l)^1+theta)/(1+theta))^(-gamma))/(1+exp(z))=beta
(exp(c(+1))-(exp(l(+1))^(1+theta))/(1+theta)^(-gamma))alpha(exp(k)exp(h(+1))^(alpha-1))(exp(l(+1))^(1-alpha))*exp(h(+1))+(1-(1/omega)*exp(h(+1))^omega)/(1+exp(z(+1)));
((exp(k(-1))*exp(h))^alpha)exp(l)^(1-alpha)=exp©+exp(k)/(1+exp(z))-(exp(k(-1))(1-(1/omega)*exp(h)^omega))/(1+exp(z));

//% CONSTRAINTS

exp(k)=(((exp(k(-1))^alpha)(exp(h))^(alpha))exp(l)^(1-alpha)+(1-(1/omega)(exp(h)^omega)exp(k(-1)))/(1+exp(z))-exp©)(1+exp(z));
exp(y)=exp©+exp(i)/(1+exp(z));
z=rho
z(-1)+e;

end;

//% INITIAL VALUES AND STEADY STATE:
initval;
k=0.567966;
i=0.0563;
l=0.3610;
h=0.251526;
c=0.2196;
z=0;
e=0;
end;

steady;
check;
//% SHOCKS: DEFINE SHOCKS

shocks;
var e = sigma^2;
end;

stoch_simul(periods=2100,order=1);[/code]

Thank you ever so much for your reply. I have now made the changes you suggested and you right, there seems to be a problem with the steady state values. It seems that I should have taken the log of the calculated values since I am using the EX LOg method here to write my model, Thus I run:

//% Notes:
//% DYNARE timing convention has been used
//% for the capital accumulation equation

//% VARIABLES AND PARAMETERS DEFINITION
var y c k h i l z;
varexo e;

parameters beta alpha gamma theta omega rho sigma;

//% CALIBRATED PARAMETER VALUES FROM THE ARTICLE
beta = .96;
alpha = .29;
gamma= 2;
theta = .6;
omega= 1.42;
rho=.51;
sigma = .045;

//% MODEL:

model;

//% FIRST ORDER CONDITIONS

exp(l)=((1-alpha)(exp(k(-1))(exp(h))^alpha)exp(l)^(-alpha))^(1/theta);
exp(h)=((alpha
(exp(k(-1)exp(h))^(alpha-1))exp(l)^(1-alpha))(1+exp(z)))^(1/omega-1);
((exp©-(exp(l)^1+theta)/(1+theta))^(-gamma))/(1+exp(z))=beta
(exp(c(+1))-(exp(l(+1))^(1+theta))/(1+theta)^(-gamma))alpha(exp(k)exp(h(+1))^(alpha-1))(exp(l(+1))^(1-alpha))*exp(h(+1))+(1-(1/omega)*exp(h(+1))^omega)/(1+exp(z(+1)));
((exp(k(-1))*exp(h))^alpha)exp(l)^(1-alpha)=exp©+exp(k)/(1+exp(z))-(exp(k(-1))(1-(1/omega)*exp(h)^omega))/(1+exp(z));

//% CONSTRAINTS
exp(k)=(((exp(k(-1))^alpha)(exp(h))^(alpha))exp(l)^(1-alpha)+(1-(1/omega)(exp(h)^omega)exp(k(-1)))/(1+exp(z))-exp©)(1+exp(z));
exp(y)=exp©+exp(i)/(1+exp(z));
z=rho
z(-1)+e;

end;

//% INITIAL VALUES AND STEADY STATE:
initval;

k=log(0.567966);
l=log(0.3610);
h=log(0.251526);
c=log(0.2196);

//%Alternatively I though that entering the ss equations (Pls see attached pdf) could help but it did not
//%h=log(((1-beta)/beta*(omega/(omega-1)))^(1/omega));
//%k=log((1-alpha)^(1/theta)alpha^((alpha+theta)/((1-alpha)theta))h^((alpha(1+theta)-omega(alpha+theta))/(theta(1-alpha))));
//%l=log((1-alpha)^(1/(alpha+theta))*k^(alpha/(alpha+theta))h^(alpha/(alpha+theta)));
//%c=log(((k
h)^alpha)l^(1-alpha)-(1/omega)(h^omega)*k);

z=0;
e=0;
end;

steady;
check;
//% SHOCKS: DEFINE SHOCKS

shocks;
var e = sigma^2;
end;

stoch_simul(periods=2100,order=1);

Though having done this I am still still getting the following error message:

SOLVE: Iteration 104
Spurious convergence.
0
-23.5979
0.1266
0.0853
0
-0.5000
0.0348

??? Error using ==> steady_ at 132
STEADY: convergence problems

Error in ==> steady at 52
steady_;

Error in ==> GHH at 118
steady;

Error in ==> dynare at 132
evalin(‘base’,fname) ;

I have attached a PDF of the model I am working on with everything solved for already i.e. FOCs, ss values. Could you please advise on what I can do to get it right. I am forever grateful for your help. Thank you so much.

Regards,
Bouba
GHH pdf.pdf (289 KB)

Recheck your equations and make sure the definition of z is consistent. From equation 7, its SS is 0, but when you put exp(z) in the model, you get a 1 there.
Also, note that in equation 2, you have
exp(k(-1)*exp(h))
which should probably be
exp(k(-1))*exp(h)

Thank you again for your prompt reply. I will double check the equations now. Many thanks.

Regards,
Bouba

Dear jpfeifer,

I have change the equations around again and again, but I do not seem to get this code running in dynare. Attached is an example rbc model which is very similar in routine to what I am trying to do, but I really cant see where I am going wrong. I have re-calculated my steady state values using the information in the attached pdf and these are correct. Your help with this matter will be most welcome. Thank you again.

Regards,
Bouba
GHH pdf.pdf (289 KB)
rbc_simple.mod (2.44 KB)

Somehow you totally screwed up the brackets. Moreover, the constraints have been substituted into the problem, so you don’t need them. 1+exp(z) should always be exp(z) and so on. I hope this one runs:

//% Notes:
//% DYNARE timing convention has been used
//% for the capital accumulation equation

//% VARIABLES AND PARAMETERS DEFINITION
var c k h l z;
//var y c k h i l z;

varexo e;

parameters beta alpha gamma theta omega rho sigma;

//% CALIBRATED PARAMETER VALUES FROM THE ARTICLE
beta = .96;
alpha = .29;
gamma= 2;
theta = .6;
omega= 1.42;
rho=.51;
sigma = .045;

//% MODEL:

model;

//% FIRST ORDER CONDITIONS

exp(l)=((1-alpha)(exp(k(-1)exp(h)))^alphaexp(l)^(-alpha))^(1/theta);
exp(h)=(alpha
(exp(k(-1))exp(h))^(alpha-1)exp(l)^(1-alpha)(exp(z)))^(1/(omega-1));
((exp©-(exp(l)^(1+theta))/(1+theta))^(-gamma))/(exp(z))=beta
(exp(c(+1))-(exp(l(+1))^(1+theta))/(1+theta))^(-gamma)(alpha(exp(k)*exp(h(+1)))^(alpha-1)*exp(l(+1))^(1-alpha)*exp(h(+1))+(1-(1/omega)exp(h(+1))^omega)/(exp(z(+1))));
(exp(k(-1))exp(h))^alphaexp(l)^(1-alpha)=exp©+exp(k)/(exp(z))-(exp(k(-1))
(1-(1/omega)*exp(h)^omega))/(exp(z));

//% CONSTRAINTS
//exp(k)=(((exp(k(-1))exp(h))^(alpha)exp(l)^(1-alpha)+(1-(1/omega)(exp(h)^omega)exp(k(-1)))/(exp(z))-exp©)(exp(z));
//exp(y)=exp©+exp(i);//(exp(z));
z=rho
z(-1)+e;

end;

//% INITIAL VALUES AND STEADY STATE:
initval;

k=log(0.567966);
l=log(0.3610);
h=log(0.251526);
c=log(0.2196);

//%Alternatively I though that entering the ss equations (Pls see attached pdf) could help but it did not
//h=log(((1-beta)/beta*(omega/(omega-1)))^(1/omega));
//k=log((1-alpha)^(1/theta)alpha^((alpha+theta)/((1-alpha)theta))h^((alpha(1+theta)-omega(alpha+theta))/(theta(1-alpha))));
//l=log((1-alpha)^(1/(alpha+theta))*k^(alpha/(alpha+theta))h^(alpha/(alpha+theta)));
//c=log(((k
h)^alpha)l^(1-alpha)-(1/omega)(h^omega)*k);
z=0;
e=0;
end;

steady;
check;
//% SHOCKS: DEFINE SHOCKS

shocks;
var e = sigma^2;
end;

stoch_simul(periods=2100,order=1);

Yes, this code runs. Thank you so much.

Regards,
Bouba

Dear Mr Julliard,

In fact what I am trying to do is to estimate the parameters in my model using Bayesian analysis. I am getting the priors figure right, but after this I get the following error message:

??? Error using ==> schur
Input to SCHUR must not contain NaN or Inf.

Error in ==> lyapunov_symm at 61
= schur(a);

Error in ==> DsgeLikelihood at 173
Pstar = lyapunov_symm(T,RQR’,options_.qz_criterium,options_.lyapunov_complex_threshold);

Error in ==> initial_estimation_checks at 60
[fval,cost_flag,ys,trend_coeff,info] =
DsgeLikelihood(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations);

Error in ==> dynare_estimation_1 at 334
initial_estimation_checks(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations);

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> GHHbayesian at 139
dynare_estimation(var_list_);

Error in ==> dynare at 132
evalin(‘base’,fname) ;.

I understand that I cannot have more observables than shocks and since my model has one shock (the one to the marginal efficiency of investment) I have chosen the observable capacity utilization, I am planning to include a TFP shock as well so I can include a second observable in consumption as using one observable perhaps may not be enough. Although the models are different, I read through your examples mod files online which replicates the estimation of the CIA model from Frank Schorfheide (2000) “Loss function-based evaluation of DSGE models”, and this was indeed very useful to me, though I do not see where I am going wrong here. Your help will be much appreciated once more. Thank you for all.

Regards,
Bouba

NB: I have attached the mod file and the data I am using.
GHHbayesian.mod (1.52 KB)
data.m (894 Bytes)

Dear jpfeifer,

The model seems to run when I am estimating one parameter, gamma for example and get rid of loglinear in the following code: estimation(datafile=data,nobs=140,loglinear,mh_replic=0,mh_nblocks=5,mh_jscale=0.8);
I am not sure why, perhaps since I am using the ex log method, this option does not apply…
Though, it looks like I have a far more serious problem when I try to estimate all the parameters, using only one shock and one observable, I get the following error:
Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

??? Error using ==> dynare at 108
DYNARE: can’t open GHHother.mod

dynare GHHother.mod

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

Starting Dynare (version 4.1.2).
Starting preprocessing of the model file …
Found 5 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
  • order 2
    Processing outputs …done
    Preprocessing completed.
    Starting MATLAB/Octave computing.

STEADY-STATE RESULTS:

c -0.875989
k 0.074472
h -1.38021
l -0.378713
z 0

EIGENVALUES:
Modulus Real Imaginary

        0.51             0.51                0
      0.9779           0.9779                0
       1.052            1.052                0
         Inf              Inf                0
         Inf              Inf                0
         Inf              Inf                0

There are 4 eigenvalue(s) larger than 1 in modulus
for 4 forward-looking variable(s)

The rank condition is verified.

You did not declare endogenous variables after the estimation command.
??? Attempted to access k(1); index out of bounds because numel(k)=0.

Error in ==> draw_prior_density at 93
binf = abscissa(k(1));

Error in ==> plot_priors at 52
[x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_);

Error in ==> dynare_estimation_1 at 87
plot_priors(bayestopt_,M_,options_)

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> GHHother at 143
dynare_estimation(var_list_);

Error in ==> dynare at 132
evalin(‘base’,fname) ;

I have gone through some of the older posts and found that a similar problem was addressed by someone else a while ago, but the reply suggests that the reason of the above error was unknown. Would you know what the problem is here by any chance. Thank you.

Regards,
Bouba

NB: the same data I send you previously applies here.
GHHother.mod (2.18 KB)

Please excuse the smile face in the above message, not sure how that got there.

Regards,
Bouba

Your current problem is related to the beta-distribution. Its support is [0,1]. Hence, you cannot have

as the mean of 2.5 is outside of its support. Use another distribution like the inverse gamma.
Similarly, change

to

as your starting values otherwise seems not be contained in the prior.

Three more things:

  1. When estimating the model with different parameters, the steady state changes as it is a function of the parameters. Hence you have to fix the steady state computation, i.e. the formulas:

[code]initval;
//k=log(0.567966);
//l=log(0.3610);
//h=log(0.251526);
//c=log(0.2196);

//%Alternatively I though that entering the ss equations (Pls see attached pdf) could help but it did not
h=(((1-beta)/beta*(omega/(omega-1)))^(1/omega));
k=((1-alpha)^(1/theta)alpha^((alpha+theta)/((1-alpha)theta))h^((alpha(1+theta)-omega(alpha+theta))/(theta(1-alpha))));
l=((1-alpha)^(1/(alpha+theta))*k^(alpha/(alpha+theta))h^(alpha/(alpha+theta)));
c=(((k
h)^alpha)l^(1-alpha)-(1/omega)(h^omega)*k);
k=log(k);
l=log(l);
h=log(h);
c=log©;
z=0;
e=0;
end;[/code]
2. Your model variabels are specified in logs by using exp(). So you don’t need to specify loglinear in the estimation command. However, your data has to correspond to the variable definition. If h in the model is the logarithm of the capital utilization your data has to be the log of the observed capital utilization, too. So the last line of your data file should most probably look like

  1. Why do you set

if you want to do Bayesian estimation? Moreover, consider using

if your Hessian is not positive semidefinite.

Dear jpfeifer,

Thank you for your useful insight and clarifications. I have implemented the changes you suggested and these prompted me to read on other relevant material on the matter. Though, when I run the mod file, I get the following errors:

STEADY: numerical initial values incompatible with the following equations
1

??? Error using ==> dynare_solve at 82
exiting …

Error in ==> steady_ at 124
[oo_.steady_state,check] = dynare_solve([M_.fname ‘_static’],…

Error in ==> steady at 52
steady_;

Error in ==> GHHother at 116
steady;

Error in ==> dynare at 132
evalin(‘base’,fname) ;

I have had a thorough look at my ss equations through Matlab and corrected for any parenthesis problem. These equations were obtained from the last pages of the attached pdf. Would you know please why this is happening?

Regards,
Bouba
GHHother.mod (1.96 KB)
GHH.pdf (289 KB)

Your

h=(((1-beta)/beta)*(omega/(omega-1))^(1/omega));
l=(1-alpha)^(1/(alpha+theta))*k^(alpha/(alpha+theta))*h^(alpha/(alpha+theta));
k=(1-alpha)^(1/theta)*alpha^((alpha+theta)/((1-alpha)*theta))*h^((alpha*(1+theta)-omega*(alpha+theta))/(theta*(1-alpha)));
c=((k*h)^alpha)*l^(1-alpha)-(1/omega)*(h^omega)*k;

uses k in line 2 before it is computed in line 3. Moreover, I thought the code I posted above works:

initval; h=(((1-beta)/beta*(omega/(omega-1)))^(1/omega)); k=((1-alpha)^(1/theta)*alpha^((alpha+theta)/((1-alpha)*theta))*h^((alpha*(1+theta)-omega*(alpha+theta))/(theta*(1-alpha)))); l=((1-alpha)^(1/(alpha+theta))*k^(alpha/(alpha+theta))*h^(alpha/(alpha+theta))); c=(((k*h)^alpha)*l^(1-alpha)-(1/omega)*(h^omega)*k); k=log(k); l=log(l); h=log(h); c=log(c); z=0; e=0; end;

Yes, you were right both codes actually work, the problem was that I had the term initval; twice. Thank you ever so much for all your help. Finally, I just have some questions regarding couple points I am not totally clear about:

  1. We used under initial value the actual equations in the ss, as you said the changes in parameters would also mean that the ss values would change hence the rational of not using exact values here. This makes perfect sense to me. However, as you can see in the attached pdf the second model at 2.3 Estimation (starting page 4), the Authors use exact values under initial, why is this possible here please?
  2. Am I right in saying that, when using the option
    estimated_params;
    for example in the case of gamma=2, the choice of where to start and where to end the distribution of the pdf i.e. 2.9,0.3; is arbitrary to some extent as I could have started with any value bigger than 2 and ended with any value smaller than 2. If this is the case, is there a rule of thumb one can follow?
  3. I am looking to do some sensitivity analysis for my model. First can you please confirm that this amounts to experimenting with different parameters values, for example initially I have
    beta = .96;
    alpha = .29;
    gamma= 2;
    theta = .6;
    omega= 1.42;
    rho=.51;
    sigma = .045;
    I could have next
    beta = .86;
    alpha = .39;
    gamma= 1.8;
    etc…
    And then check in each case if I get the same posterior mean. I will be doing all this while keeping the following unchanged:
    estimated_params;
    stderr e,inv_gamma_pdf, 0.95,inf;
    gamma,inv_gamma_pdf,2.9,0.3;
    beta, beta_pdf, 0.97, 0.1;
    alpha, beta_pdf, 0.31, 0.02;
    rho, beta_pdf, 0.7, 0.02;
    omega, inv_gamma_pdf, 2.5, 0.05;
    sigma, normal_pdf, 0.3, 0.005;
    end;

If this is what the sensitivity analysis amount to, could you please tell me how one can best edit the option
estimation(datafile=data,nobs=140,mh_replic=10000,mh_nblocks=5,mode_compute=6, mh_jscale=0.8);
just to get the information needed, in this case the posterior mean, would it be sensible to set mh_replic=0 during the sensitivity analysis?
And Finally
4. Looking at my result, I found that the prior mean for gamma was 2 while the posterior mean was around 9. Obviously this is not good news, as the posterior mean should be very close to the prior mean. Would increasing the number of mh_replic help with this issue, or is there another more efficient solution to this problem?

NB: is there any article or website you can refer me to on how to interpret in general the output produced by dynare for Bayesian estimation i.e. how do I interpret the Brooks and Gelman (1998) diagnostic, I know that this provide a condition for convergence but what does the graph means i.e. what’s a good graph and what’s a bad graph.

Many thanks.

Regards
Bouba
Practicing Dynare.PDF (414 KB)

  1. For some models the starting values do not matter as Dynare is able to find the steady state values easily by starting from anywhere in the parameter space. In particular, for linear models there is only one unique steady state. As the nonlinearity increases, giving exact starting values becomes more important.
  2. Choosing a good prior distribution is an art. Ideally you want to let the data speak as freely as possible by choosing a non-informative prior. However, often the data (likelihood) does not contain much information about a parameter. In this case, choosing an informative prior is an important advantage of Bayesian methods that allows nevertheless estimating the model by incorporating prior information. There are attempts to give guidelines about choosing parameters econ.upenn.edu/~schorf/papers/dummyprior.pdf, but in general it is hard to give definite advice. Most importantly, the posterior assigns 0 likelihood to parameters regions that are not in the support of the prior. So one should be careful in restricting the prior space unless there is good reason too. If you do not know the range of a parameter, choose a wide prior. In contrast, if you know that alpha always is between 0.25 and 0.4 there is no reason to use a wider prior.
  3. Sensitivity analysis would proceed in the way you describe. However, I would recommend using the syntax of the estimated_params block to specify starting values, e.g.:

Regarding the estimation-command, you cannot set the mh_replic=10000 as this is the number of MCMC draws which is currently rather small if you want to have a sensible burn-in (Dynare drops 50% by default). Rather, you don’t want to have 5 separate chains starting at the same values to test if they converge to the same posterior mode as you want to have several chains from different starting values.
4. Your statement is wrong. Having the posterior diverge from the prior means that your data (the likelihood in Bayes rule) is very informative about the parameter (if the posterior distribution is not too wide around the mode). If all your posterior estimates would coincide with the prior mean, there would be no reason for estimation as the data does not add any new insights. Things are only different, if you are trying to replicate a study and your prior mean is already the posterior of an estimated model (not a calibrated one!). Then having different results may signal trouble.

NB: You may want to have a look at lehre.wiwi.hu-berlin.de/Professuren/vwl/wipo/team/former/kriwoluzky/intro_dynare_handout.pdf

Thank you once more for your very detailed and clear response. Just to clarify one of the point you made in part 4 of your answer " Things are only different, if you are trying to replicate a study and your prior mean is already the posterior of an estimated model (not a calibrated one!)" . In my case, since I am using a model which was calibrated using micro founded evidence about the deep parameters, my prior means are the relevant micro values used to calibrate the model. Thus, I understand by your explanation that for example although the value for gamma was 2 when the model was calibrated, the posterior mean I obtained being 9 is not an issue i.e. if this was indeed an issue what advice would you give me?. In the event of the later, not being a problem, is it right then to say that the model should be re-estimated using a value of gamma equal to 9?
I suspected that choosing the right bounds for the parameters was more of an art, hence this clearly is something I would need to double check with you since my understanding of all the present is only very recent. So do you think that my choice for bounds are ok in general:

stderr e,inv_gamma_pdf, 0.95,inf;
gamma,inv_gamma_pdf,2.9,0.3;
beta, beta_pdf, 0.97, 0.1;
alpha, beta_pdf, 0.31, 0.02;
rho, beta_pdf, 0.7, 0.02;
omega, inv_gamma_pdf, 2.5, 0.05;
sigma, normal_pdf, 0.3, 0.005;

And finally, two things is doubling the mh_replic to 20000 a better option?

Thank you so much for all your help.

Regards,
Bouba

It is well known that micro-estimates of parameters may differ from parameter estimates in DSGE models. The best-known example is the Frisch elasticity of labor supply. The problem is that we often do not know how the microeconomic behavior translates to the aggregate. Hence, it is often difficult to take micro-evidence literally. Often they serve as a good starting point for the estimation, because these studies are prior knowledge. Getting a different posterior is not necessarily a bad sign as the data tells you it is more likely that the parameter has a different value, i.e. 9 instead of 2. This new information is the reason why you try to estimate the parameter in the first place.
Note that the difference to micro-evidence can have different reasons, some good, some bad. It may simply be due to aggregation or it could be that your model is severely misspecified. Consider for example the Frisch elasticity: if the true data generating process is something like and RBC model with a search and matching framework and you estimate this parameter using a monopolistic labor market with wage stickiness and indexing, the estimate may differ from the true value just because your model cannot capture the data generating process.

What do you mean with reestimate? Starting with Bayes rule and a prior of 2 for gamma, your new posterior is 9. If you estimate the model on a different data, you could reasonably argue that your new prior should be this posterior of 9. But if you are only comparing different models on the same data, you should use the prior of 2 and do model comparison.

Regarding the priors, it seems to me that most of the parameters may be standard in the literature. So orient yourself in these studies, e.g. with Schmitt-Grohe/Uribe (2010) with GHH preferences and investment specific technology columbia.edu/~mu2166/news_in_bc/paper.pdf, Fernandez-Villaverde (2010) for alpha and beta econ.upenn.edu/~jesusfv/econometricsDSGE.pdf and the classical work of An/Schorfheide econ.upenn.edu/~schorf/papers/er-final.pdf

Regarding mh_replic, the Dynare standard is 20000. In general, it is impossible to say a priori if this is sufficient or not. You have to make sure that your MCMC has converged to the posterior distribution. If this is already the case after 10000 iterations then this suffices. However, convergence could also only happen after 50000 draws or even more. You have to check this, e.g. using trace plots or convergence diagnostics. I personally would feel more comfortable with at least 20000 draws, which means a burn-in phase of 10000.

Well, I feel as every single question I had on Bayesian estimation has been clearly and fully answered by you. All what is left to do now, I believe is to hit the books for more details. I am forever grateful for the unique support and help you have provided me with.

Thank you ever so much, God Bless you.

Regards,
Bouba

Hi jpfeifer ,

I have run into a strange problem and I was wondering if you could please help.
I just solved the GHH (1988) paper using quadratic approximation in Matlab. By running the file titled mainfile.m in Matlab (NB: make sure that hessp.m, gradp.m and utilfun.m are all in the same folder) I could get the same set of stdv, autocorrelation and other statistics presented in the paper. Note, that some of my steady states values here are :
k=0.567966;
l=0.3610;
h=0.251526;
c=0.2196;

Since my aim is to replicate GHH using Bayesian estimation, I though that a good place to start would be to first solve the model in Dynare, I therefore wrote the attached .mod file. And then, the following problem occurred: Although the file can run and gives me the statistics I need, the calculated steady states are completely different and thus the autocorrelation and other vital statistics between variables are also different. I actually get:
STEADY-STATE RESULTS:

y -0.64755
c -0.875989
k 0.0744721
h -1.38021
l -0.378713
i -2.23608
z 0

I tried using directly the values above as initial value in dynare but this gives me the following error message;

SOLVE: maxit has been reached
??? Error using ==> steady_ at 132
STEADY: convergence problems

Error in ==> steady at 52
steady_;

Error in ==> GHH at 120
steady;

Error in ==> dynare at 132
evalin(‘base’,fname) ;

But as I said, if you use the equations the file runs but the statistics are not correct. Thank you again.

Regards,
Bouba
GHH.mod (1.81 KB)
hessp.m (1.47 KB)
gradp.m (983 Bytes)
utilfun.m (485 Bytes)
mainfile.m (7.05 KB)