I am trying to estimate the Hansen Sargent Tallarini (1999) model using the procedure suggested by Barillas et al. (2010). Unfortunately, the estimation does not yield proper results and I cannot find the problem. Any help would be much appreciated.

a few additional information:
I use Dynare 4.4.2;
mode_compute=4,8,9,10 return estimated parameters that are equal to the initial values (I have tried many different initial values and bounds);
mode_compute=6 yields the following error:
“Error using chol
Matrix must be positive definite.”

Does someone know how to solve this problem? You would really help me out.

I added the data file as an appendix. DataHighIPD.xls (30 KB)

Thank you very much for your answer. I worked through your paper but could not find the problem in the above-attached .mod file: Dynare is able to compute the SS, the IRFs have the expected shape, the timing is correct, the observed variables are stationary, etc.

Could you please be more precise about the incorrectness of the attached model? Many thanks in advance.

You e.g. tell Dynare that you observe the level of consumption. But which data do you provide Dynare? It looks like first log-differences and not the level of consumption.

Thank you very much for your help: using series in levels and controlling for nonstationarity via the “lik_init=2” option greatly improves the estimations. Unfortunately, however, “mode_check=6” is still not working. What could be the reason for it?

Also, I would like to compare the unrestricted model with a restricted version (e.g. without habits) in order to see which one better explains the data. Where can I find the (maximum) likelihood values? Sorry for the triviality of my question but I could not find a fitting answer on the forum/tutorials.

Using just the levels is still wrong. Your data will have a trend, will not be logged and will have a different steady state than the model variables. Use first differences and a correctly specified observation equation.

For comparing models, see the manual on the model_comparison command.

Thank you for your answer. 1) If I understand you right, I can keep the variables in 1st log-differences and simply define my observed variables as

c_obs=log(c)-log(c(-1));
i_obs=log(i)-log(i(-1));? Note that I do not want to control for measurement errors and the like.

**2) **The command “model_comparison HSTML HSTML2 ;” (where HSTML2 excludes habit formation), yields the following error:
"model_comparison:: The user supplied prior distribution over models is improper…
model_comparison:: The distribution is automatically rescaled!
Error using model_comparison (line 50)
Not enough input arguments."
Is it because “model_comparison” does not work with maximum likelihood estimations or because I am still missing something in 1)? Can I also use the “Fval obtained by the minimization routine” or the “Initial value of the log posterior (or likelihood)” for model comparison under maximum likelihood?

Could you provide me with the code? Note that model comparison under ML estimation only works for nested models. In that case you can just take the “Fval obtained by the minimization routine” and use it for a likelihood ration test.

Thank you so much for your help. The code is attached.

I posted the wrong error message for the model_comparison command, the correct error message is the following:
“MODEL_COMPARISON: I cant’t find the Laplace approximation associated to model HSTML”.
I don’t know if it is due to a mistake in the model specification or to Dynare. But since I use nested models, I will use the “fval” and manually compute the LR stat & p-values. Thank you for that hint. HST_ML.zip (3.85 KB)

Sorry, but model_comparison curently only works with Bayesian estimation as models don’t need to be nested here.
By the way: you are aware that your capital stock is hugely negative in the steady state of your model? This suggests a bug somewhere.