Page 1 of 1

Quick question about simulation

PostPosted: Mon Dec 23, 2013 5:07 pm
by macroresearch123
Hi,

My model is working properly (thankfully), albeit with a simplification relative to my initial hopes, but my next objective is to see how well the model predictions matche observed empirical regularities. How would I do this? While the share of labor is normalized to one so that the steady state prediction can be readily compared to the real world, what about other model variables, such as consumption and capital? Put more compactly, how can I simulate an economy starting at some given time period with the given corresponding variable values and see how it evolves for some T years?

I have checked extensively online, but I cannot find any other documentation other than the stoch_simul command that I am already using. (Code attached)

Thank you as always for your insight and time!

Re: Quick question about simulation

PostPosted: Fri Dec 27, 2013 10:43 am
by jpfeifer
Normally, you would compare business cycle moments to the ones in the data. This can be done by using the theoretical moments based on the state-space representation. If you want to simulate a time series, you can use the simult_ - command. An example can be found at https://sites.google.com/site/pfeiferecon/RBC_news_shock_model.mod?attredirects=0

Re: Quick question about simulation

PostPosted: Sat Dec 28, 2013 1:53 am
by macroresearch123
Hi Johannes,

This is very helpful. Is there further documentation on the use of "simult"? What you built in your file is great, but there are some terms that I am unfamiliar with. In particular, where in the following code do you call for the specific endogenous variable you want to simulate? I was looking in the "y2=simult_" command, but that just looks like you're simulating all variables. Regarding the shock matrix that you created, we would just rename that with whatever name our specific shock has, i.e. "eps", and then remove the second "surprise" shock?


--
initial_condition_states = repmat(oo_.dr.ys,1,M_.maximum_lag);
shock_matrix = zeros(options_.irf,M_.exo_nbr); %create shock matrix with number of time periods in colums

// set shocks for pure news
shock_matrix(1,strmatch('eps_z_news',M_.exo_names,'exact')) = 1; %set news shock to 1 (use any shock size you want)
shock_matrix(1+8,strmatch('eps_z_surprise',M_.exo_names,'exact')) = -1; %8 periods later use counteracting shock of -1

y2 = simult_(initial_condition_states,oo_.dr,shock_matrix,1);
y_IRF = y2(:,M_.maximum_lag+1:end)-repmat(oo_.dr.ys,1,options_.irf); %deviation from steady state

// manually select variables for figure
figure
subplot(2,1,1)
plot(y_IRF(strmatch('y',M_.endo_names,'exact'),:)); % use strmatch to select values
title('Output');
subplot(2,1,2)
plot(y_IRF(strmatch('z',M_.endo_names,'exact'),:));
title('TFP');

Re: Quick question about simulation

PostPosted: Sun Dec 29, 2013 8:04 am
by jpfeifer
No, there is no further documentation yet apart from the information in the header

You have to simulate all variables when using simult_. There is currently no other way. The y_IRF(strmatch('y',M_.endo_names,'exact'),:) then selects e.g. the variable named 'y' for the plot.

You can specify the shock matrix anyway you want. The procedure you describe would be correct.