variance decomposition

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

variance decomposition

Postby stjosef » Mon Mar 21, 2016 1:09 pm

Hello everybody!

For my master thesis I am trying to estimate a two-sector open economy DSGE model for Germany and the Rest of the Euro area following the theoretical framework of Ferrero et al. (2008). I brought the estimation to run and the irfs seem to have reasonable results, however when I try to compute conditional variance decompositions for production, consumption, trade balance and current account the following error messages show up:

------------------------------------------------------------------------------------
Index exceeds matrix dimensions.

Error in dsge_simulated_theoretical_variance_decomposition (line 113)
Decomposition_array(linea,(i-1)*nexo+j) = tmp{2}(i,j);

Error in posterior_analysis>job (line 62)
dsge_simulated_theoretical_variance_decomposition(SampleSize,M_,options_,oo_,'posterior');

Error in posterior_analysis (line 34)
oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_);

Error in compute_moments_varendo (line 101)
oo_ =
posterior_analysis('decomposition',var_list_(i,:),M_.exo_names(j,:),[],options_,M_,oo_);

Error in dynare_estimation_1 (line 818)
oo_ = compute_moments_varendo('posterior',options_,M_,oo_,var_list_);

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

Error in thesis_test2 (line 502)
dynare_estimation(var_list_);

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

Unfortunately I don't know what problem the error messages indicate and how it can be solved in order to get valid variance decompositions.

Another issue I am having with the estimation is that the posterior distributions for some parameters fit the priors very poorly and seem to be concentrated far too narrowly around the posterior mean. Is this solely due to the fact that my model is relatively simple compared to more complex models like e.g. Quest or could this have another reason?

Help would be very much appreciated. Thanks in advance!
Last edited by stjosef on Tue May 24, 2016 2:32 pm, edited 1 time in total.
stjosef
 
Posts: 5
Joined: Mon Mar 21, 2016 10:54 am

Re: variance decomposition

Postby stjosef » Mon Mar 21, 2016 1:11 pm

...here the data
Last edited by stjosef on Tue May 24, 2016 2:33 pm, edited 1 time in total.
stjosef
 
Posts: 5
Joined: Mon Mar 21, 2016 10:54 am

Re: variance decomposition

Postby jpfeifer » Tue Mar 22, 2016 10:29 am

Which Dynare version are you using? Could you please try the unstable version if it works there?
There is nothing that says a prior should look like the posterior. Quite the opposite. You want your data to be informative. It is only problematic when the posterior results make no economic sense.
A general tip: check your data and observation equation. could it be that there are still seasonal patterns in the data? And why is the variance of nx so much bigger than of every other variable? Is this a scaling issue?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: variance decomposition

Postby stjosef » Tue Mar 22, 2016 3:47 pm

Thank you very much for your response and help!

I am generally using version 4.4.3. I tried running the whole estimation with unstable versions 2016-03-19 and 2016-03-21 now but the estimation doesn't work anymore at all and I get the following error messages:

----------------------------------------------------------------------------------
Error using chol
Matrix must be positive definite.

Error in gmhmaxlik_core (line 194)
dd = transpose(chol(CovJump));

Error in gmhmaxlik (line 100)
[PostMode, PostVariance, Scale, PostMean] = gmhmaxlik_core(fun, OldPostMode, bounds,
gmhmaxlikOptions, Scale, flag, MeanPar, OldPostVariance, varargin{:});

Error in dynare_minimize_objective (line 250)
[opt_par_values, hessian_mat, Scale, fval] = gmhmaxlik(objective_function,
start_par_value, ...

Error in dynare_estimation_1 (line 252)
[xparam1, fval, exitflag, hh, options_, Scale] =
dynare_minimize_objective(objective_function,xparam1,options_.mode_compute,options_,[bounds.lb
bounds.ub],bayestopt_.name,bayestopt_,hh,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);

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

Error in thesis_test2 (line 511)
oo_recursive_=dynare_estimation(var_list_);

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

For connecting the data to the model I indexed all variables on the same scale (2010=1) and then I followed your paper of 2013 by taking logs and detrended by first difference. Finally I demeaned the data automatically through the estimation command. I also realized the much higher variance in nx but I followed the very same pattern as for all the other variables. So you think its a data related issue?
stjosef
 
Posts: 5
Joined: Mon Mar 21, 2016 10:54 am

Re: variance decomposition

Postby jpfeifer » Thu Mar 24, 2016 8:35 am

How do the mode_check plots look like?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: variance decomposition

Postby stjosef » Thu Mar 24, 2016 12:14 pm

The mode_check plots are attached to this message.

I now detrended all data by HP filter instead of taking first differences. I also deseasonalized the three series that haven't been seasonally adjusted yet. However, these changes don't solve the problem. One thing I realized is that I can get theoretical posterior moments and conditional variance decompositions for endogenous shock process variables like ah uh an un etc. but not for economically interesting endogenous variables like y c nx or ca. Do you have an idea why this is the case?

Thank you very much for your time and help!
Attachments
plot4.pdf
(3.13 KiB) Downloaded 116 times
plot3.pdf
(10.55 KiB) Downloaded 95 times
plot2.pdf
(10.62 KiB) Downloaded 100 times
plot1.pdf
(10.36 KiB) Downloaded 98 times
stjosef
 
Posts: 5
Joined: Mon Mar 21, 2016 10:54 am

Re: variance decomposition

Postby jpfeifer » Tue Mar 29, 2016 8:14 am

Do not use the two-sided HP-filter for Bayesian estimation of DSGE models. See Pfeifer (2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.
Have you check identification in your model?
Not getting endogenous moments usually means there is a unit root in your model so that those unconditional moments are not finite.

But let's step back for a moment: you said in a previous version you were able to run the estimation. Have you compared what the difference between versions is? Is there a notable difference in the density at the found mode?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: variance decomposition

Postby stjosef » Thu Mar 31, 2016 2:15 pm

Ok, I use a one-sided HP filter now and re-estimated the model. The results don't seem to differ a lot from before.

My problem is actually "solved" now. I get variance decompositions for endogenous variables but ONLY if the posterior theoretical moments for shock process variables ah and an are also computed in the same estimation.

Actually there are unit roots in two of the structural equations, I guess that's also the reason why I have to set the option lik_init=2 to get the estimation to run. To my knowledge identification is achieved. Is there a way to explicitely check for valid identification of the model in Dynare?

Generally the estimation only runs without error messages using Dynare version 4.4.3., but not if I use an unstable version.
stjosef
 
Posts: 5
Joined: Mon Mar 21, 2016 10:54 am

Re: variance decomposition

Postby jpfeifer » Tue Apr 05, 2016 3:50 pm

You can use the
Code: Select all
identification
command to check identification (unless you have correlated errors)
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: variance decomposition

Postby ZBCPA » Thu Mar 30, 2017 11:01 am

jpfeifer wrote:You can use the
Code: Select all
identification
command to check identification (unless you have correlated errors)


Dear Johannes,

Should "identification" command be added After estimation block?
Code: Select all
estimation(....);
identification;
stoch_simul(...);


Kind regards,
Huan
ZBCPA
 
Posts: 101
Joined: Sat May 16, 2015 4:15 am

Re: variance decomposition

Postby jpfeifer » Thu Mar 30, 2017 7:14 pm

In the unstable version, it should not matter. But usually you want to know about identification before running estimation. The usual way is to check identification first and then take the command out of the mod-file before running estimation. Note that if you run identification before an estimation-command, you need to sometimes provide options like
Code: Select all
diffuse_filter
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 6 guests