This project is read-only.

issue with deterministic trends

Topics: Kalman Filtering, Models
Jun 24, 2014 at 8:40 AM
Hi, folks

Good to be back to the Iris community again...

I am having an issue with exogenous variables (in my case manually detrended time series of observables, which I put in the data file) that I use in !dtrends: the function simulate() does not take them onboard and consequently can not graph them on a shock contribution picture, which is annoying.

By the way, i noticed a slight error on the shock contribution graphs on pages 13 and 14 of the filter_hist_data.mfile of the Tutorial Simple_SPBC.model: The steady state line should be taken from column end-2 and not end-1. By the way, what does represent the column end-1?

Thanks and all the best,

Jun 27, 2014 at 2:48 PM
Edited Jun 27, 2014 at 2:53 PM
Hi Nic

Nice to hear from you.

Regarding the dtrends issue -- it seems to work ok on my computer as intended, so let me briefly summarize the possible traps (you're more than welcome to make suggestions if something doesn't seem to make sense to you). The dtrends (including the effect of exog variables) are added to measurement variables only if the option 'dtrends=' is true. By default, this option is 'auto' which means that its behavior depends on the option 'deviation='. If 'deviation=' true then dtrends are not added by default unless you manually set 'dtrends=' true. On the other hand, if 'deviation=' false, dtrends are added by default (unless you override the default behavior by setting 'dtrends=' false).

Finally, the contributions of dtrends to measurement variables are reported together with the contribution of init cond and constant in the (NE+1)-th column, where NE is the number of shocks. This is currently the second to last column. The very last column, i.e. column NE+2, is the contribution of nonlinearities in nonlinear simulations (this is a new column added recently).

Here's a summary:
% Dtrends will be added to measurement variables,
% and reported in the second to last column.
s = simulate(m,d,1:40,'contributions=',true);

% Dtrends will *not* be added to measurement variables,
% and *not* reported.
s = simulate(m,d,1:40,'deviation=',true,'contributions=',true);

% Dtrends will be added to measurement variables,
% and reported in the second to last column.
% All variables will be otherwise deviations from sstate
s = simulate(m,d,1:40,'deviation=',true,'dtrends=',true,'contributions=',true);
Regarding the error in the tutorial. You are right. As explained above, we have recently added a new contributions column, the effect of nonlinearities (which is nonzero only in nonlinear simulations). In other words, the contributions have now NE+2 columns (where NE is the number of shocks): columns 1...NE are the shock contributions, column NE+1 is the contribution of init cond, constant, and dtrends (incl. exogenous variables), and column NE+2 is the contributions of nonlinearities.

I will soon also separate the contributions of dtrends (incl. exog variables) into a separate column (which is also the case in the VAR models with exog variables).

Please let me know if you still see some erroneous behavior, or if you think it would make sense to change the way it functions currently.

Marked as answer by jaromirbenes on 6/27/2014 at 6:50 AM
Jun 27, 2014 at 9:35 PM
Hi Jaromir

It still does not work on my computer. Here the declaration in my model.mod:




Ratx_ += ratx_tr;

with ratx_tr is contained in my data file data_trans.

Then in my m file:

fprintf('Running filter... \n');
% [m_filtered,smooth,V,Delta,PE,SCov] = filter(m,data_hp,frng);
[m_filtered,f,V,Delta,PE,SCov] = filter(m,data_trans,frng);
fprintf('Done. \n');

% Simulate (database s) and compute shock contributions database c

s = simulate(m_filtered,f.mean,qq(1982,1):qq(2012,3),'deviation',false,'anticipate',false,'contributions',true);

c = simulate(m_filtered,s,qq(1982,1):qq(2012,3),'deviation',false,'contributions',true,'anticipate',false);

For c.Ratx_, I ultimately obtain a T-2 column full of NaN... Note that I use the filtered model m_filtered and the filtered variables as an input database.

Any idea what's happening?




Jun 27, 2014 at 9:47 PM
Hi again Jaromir

I think, I have the answer : It is simply because the exogenous variable ratx_tr (see my latest email) is not passed to the filtered database that I use as an input database for simulate()- How could I elegantly solve this?



Jun 27, 2014 at 10:19 PM
Hi Nic

This is an omission of mine. I'll fix it in the next release so that the output database will contain also exogenous variables (feel free to submit an issue for this). In the meantime, you'll have to manually include the series in the database for simulation... Sorry about that.

Marked as answer by jaromirbenes on 6/27/2014 at 2:19 PM
Jun 28, 2014 at 12:50 AM
I've already created an issue for this. Will be fixed soon.

Jun 28, 2014 at 9:43 AM
Thanks, that's great!