Smoother

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.

Smoother

Postby draoul » Fri Jun 26, 2015 10:23 am

Dear all,

I have a question regarding the smoother implemented in Bayesian estimation. Does dynare compute the smoothed variables conditional on the posterior mean after estimation? I am asking because I calibrated my model at the posterior mean, simulated it using stoch_simul and computed the smoothed variables using the calib_smoother command. However, the smoothed estimates differ (the differences are small but visible when I plot the two series together (see attached figure).

Best,

Raoul
Attachments
smoothed estimates.pdf
(4.52 KiB) Downloaded 273 times
draoul
 
Posts: 10
Joined: Wed May 13, 2015 12:24 pm

Re: Smoother

Postby qazi.haque » Tue Jun 30, 2015 6:56 am

Hi Raoul,

After running MCMC Dynare computes the smoothed estimates of the endogenous variables at the posterior mean.

Cheers,
Qazi
qazi.haque
 
Posts: 18
Joined: Thu Nov 06, 2014 11:37 am

Re: Smoother

Postby jpfeifer » Sun Jul 05, 2015 4:23 pm

The estimation command computes the mean estimates, i.e. the average smoother results over the MCMC parameter draws. In contrast, stoch_simul after estimation computes the smoother at the mean of the parameter values. Those are two different things.
------------
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: Smoother

Postby draoul » Mon Jul 06, 2015 8:17 am

Thanks a lot for your answer.

I see your point. However, is this also true if I do not include the smoother option in the estimation command? Because then dynare also computes smoothed shocks (saved under oo_.SmoothedShocks.shockname). I thought, these might be the ones based on the posterior mean and I was reffering to these shocks (oo_.SmoothedShocks.shockname and not oo_.SmoothedShocks.Mean.shockname) when comparing them to the smoothed shocks obtained by the calib_smoother.
draoul
 
Posts: 10
Joined: Wed May 13, 2015 12:24 pm

Re: Smoother

Postby jpfeifer » Mon Jul 06, 2015 8:56 am

oo_.SmoothedShocks should only be set by the estimation command if it is used with the smoother option. Alternatively, the calib_smoother command will set it.
------------
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: Smoother

Postby yinx » Mon Aug 03, 2015 4:52 pm

Hello All,
Please can you provide an example of how to use calib_smoother.
Thank you.
Yinka
yinx
 
Posts: 10
Joined: Sat Oct 26, 2013 1:18 am

Re: Smoother

Postby yinx » Mon Aug 03, 2015 4:54 pm

P.S. I would prefer if the command set up is for filtered variables please.
yinx
 
Posts: 10
Joined: Sat Oct 26, 2013 1:18 am

Re: Smoother

Postby jpfeifer » Mon Aug 03, 2015 5:44 pm

One example is here: https://github.com/DynareTeam/dynare/blob/master/tests/fs2000/fs2000_calib.mod. The fsdat_simul.m dataset is in the Dynare examples folder.
------------
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: Smoother

Postby yinx » Mon Aug 03, 2015 7:38 pm

Thank you for your help.
yinx
 
Posts: 10
Joined: Sat Oct 26, 2013 1:18 am

Re: Smoother

Postby kipfilet » Mon Jun 06, 2016 10:53 pm

Hi,
Apologies if this is a stupid question, but I still haven't understood why "oo_.SmoothedVariables" and doing simult_ with oo_.SmoothedShocks generates slightly different results?
kipfilet
 
Posts: 27
Joined: Thu Oct 04, 2012 5:24 am

Re: Smoother

Postby kipfilet » Tue Jun 07, 2016 12:10 am

To be more clear,my procedure is as follows:
1) Estimation/Smoother creates a sequence of oo_.SmoothedVariables, where the smoothed observables match the data perfectly
2) It also generates oo_.SmoothedShocks. I assumed that doing simult_ with this sequence of smoothed shocks would allow me to retrieve oo_.SmoothedVariables.
3) I eliminate the first row of oo_.SmoothedShocks, set y0=oo_.SmoothedVariables(1) and do
simult_(y0, oo_.dr, shocks, 1)
The output is not exactly the same as oo_.SmoothedVariables. Some of the variables are quite similar, but others are considerably different, it almost seems that one or more shocks are missing!
I saw in other threads that some people have issues with steady state values, etc, but my model is written in log-linear form (i.e. I am writing the model so that steady states are zero for all variables) and data is detrended/demeaned before estimation.

Am I missing anything?
kipfilet
 
Posts: 27
Joined: Thu Oct 04, 2012 5:24 am

Re: Smoother

Postby jpfeifer » Tue Jun 07, 2016 8:59 am

------------
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: Smoother

Postby kipfilet » Tue Jun 07, 2016 4:09 pm

Hey Johannes,
First of all, thanks a lot for taking the time to read my "complaint" and for suggesting a solution.
It seems to be working now! But I am curious as to what was the issue.

I went carefully over your file, and everything coincides with what I was doing from line 118 onwards.
The only difference (the only change I made to my code) is that I added the "smoother" option to "estimation". Now, instead of oo_.SmoothedVariables being a structure of the kind oo_.SmoothedVariables.(varnames), it is of the kind oo_.SmoothedVariables.(yyy) where
(yyy) = {Mean, Median, Var, deciles, HPDInf, HPDSup}
and each of these in turn is of the type oo_.SmoothedVariables.(yyy).(varnames). To obtain the results that match exactly, I am using the Mean for both SmoothedVariables and SmoothedShocks.

I am very happy that this got solved, but out of curiosity, would you mind explaining what the difference is with respect to what I was doing?
I guess my question can be reframed as follows: if I do not specify the "smoother" option when estimating the model, Dynare still generates a sequence of oo_.SmoothedVariables and oo_.SmoothedShocks, where the former coincide with the data exactly for the observables. But what are these objects, exactly?

Thanks again!
kipfilet
 
Posts: 27
Joined: Thu Oct 04, 2012 5:24 am

Re: Smoother

Postby jpfeifer » Wed Jun 08, 2016 5:08 pm

My guess is that it has to do with the variable ordering of the matrix returned by the non-MCMC smoother.
------------
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 10 guests