Hi,
I was trying to estimate Ireland’s 2010 paper “A New Keynesian Perspective on the Great Recession”
At the beggining I was trying to do that by using the default option (Chris Sims’ csminwel), but I had the following error:

??? Error using ==> chol
Matrix must be positive definite.

Error in ==> metropolis_hastings_initialization at 52
d = chol(vv);
…

So I then I tried to use “simulated annealing-like optimizer” (mode_compute=4). So it worked (at least the program was running). The problem is that the posterior distributions of the parameters are completely different to the priors. The other problem I had is that there is and error when dynare attemps to compute the posterior IRFs

??? Undefined function or method ‘cs’ for input arguments of type ‘double’.

Error in ==> PosteriorIRF_core1 at 179
y = 100*y/cs(i,i);

Error in ==> PosteriorIRF at 209
[fout] = PosteriorIRF_core1(localVars,1,B,0);

Error in ==> dynare_estimation_1 at 897
PosteriorIRF(‘posterior’);

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

Error in ==> ireland_repl at 216
dynare_estimation(var_list_);

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

I do not know whether my prior distributions doesn’t make sense or if I have to manipulate the data in someway.
I will appreciate if someone could help me. I’m posting the mod file and the data file.

Having a posterior different from the prior is not a problem per se, it might simply mean your data is really informative.

If you don’t know if your prior is sensible, there is no point in using a prior. Just do a maximum likelihood information. If you actually meant posterior instead of prior, compare it to Ireland’s paper.

Regarding the “Matrix must be positive definite.” continue using mode_compute=6.

Finally, from having a short look at your mod-file, you need to specify a correct observation equation to map the growth rates (I guess) in your data file into the model variables. Search the forum on how to do this.

Thank you for that.
I actually made some adjustements in data set I have (following Ireland)

I redefined output as: log(y)-mean(y)
inflation=log(pi)-mean(pi)
interest rate=log®-mean(y)+log(exp(mean(y))/exp(mean®))-mean(pi)

I also defined in the mod file the corresponding observation equations, as you suggested (I follwed the mod file US_IR11_rep, that I found in the list of replication papers of Dynare).

But now when I run the estimation I have the following error:

??? Error using ==> print_info at 39
Blanchard Kahn conditions are not satisfied: no stable equilibrium

Error in ==> initial_estimation_checks at 101
print_info(info, options_.noprint)

Error in ==> dynare_estimation_1 at 122
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 ==> ireland_repl_est2 at 182
dynare_estimation(var_list_);

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

Then if I remove the observation equation for the output gap, it works but I’m not sure about the results.