Aggregate Output Loss due to Shock

Dear all,

I am new to Dynare and have a question whether it is possible to calculate the aggregated output loss due to a shock. The shock is for 10 Periods, and I wanted to know whether there is an easy command to calculate the difference between the aggregate outcome in case of a shock and the output had the model remained in the steady state for all the simulated periods. Of course you could just use sum(y) and calculate the aggregated steady state output yourself and then take the difference, but there must be an easy command for this, surely?

Thanks to all of you!aggregate_loss.mod (506 Bytes)


Sorry to disappoint you, but there is no such “magic” command in Dynare.

One way to proceed is indeed to do what you did, i.e. to manually compute the sum at the end. However note that you made a mistake: the y vector contains 51 observations, because of the initial condition. So the right calculation is 15*51-sum(y).

Another avenue is to define a new variable, say aggloss in your model, with the following law of motion:
aggloss=y-STEADY_STATE(y) + aggloss(-1);. Don’t forget to also put aggloss=0; in the initval block (even though it’s implicit initialized at zero, it’s better to explicitly set it). After simulation, the last observation of aggloss gives the value you are looking for.

Both ways of calculating this loss give 107.38 on your particular example.


Hi Sebastian,

thank you for your answer, I greatly appreciate it!