# How to calculate cumulative effects?

**URL:** <https://forum.dynare.org/t/how-to-calculate-cumulative-effects/22021>\
**Category:** Stochastic simulations\
**Created:** [1 March 2023 04:34 UTC](https://forum.dynare.org/t/how-to-calculate-cumulative-effects/22021 "2023-03-01T04:34:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VS19](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/77aa72/32.png) [@VS19](https://forum.dynare.org/u/VS19)\
**Post date:** [1 March 2023 04:34 UTC](https://forum.dynare.org/t/how-to-calculate-cumulative-effects/22021/1 "2023-03-01T04:34:48Z")

</div>

Hi Everyone,

I am trying to run a simulation in which I attempt to calculate cumulative effects of a shock to variables of interest over some horizon. For example, I am trying to see cumulative effects of a shock to loan-to-value ratio on output on impact and over 40 quarters. I did a search and it seems it has to be done manually (see the post here [Cumulative multipliers in Dynare](https://forum.dynare.org/t/cumulative-multipliers-in-dynare/17826)). I reckon I perhaps have to simulate the model for the desired horizon (lets’s say 40 quarters) and then I have to sum the IRFs. Is that correct? Because in the post that I linked, it is being calculated like this:

`cummultyi=(sum(y_epsi)/sum(gi_epsi))`

I am not sure why there’s a division. Will appreciate any advice.

---

<div class="post-metadata">

**Author:** ![DoubleBass](https://forum.dynare.org/user_avatar/forum.dynare.org/doublebass/32/17420_2.png) [@DoubleBass](https://forum.dynare.org/u/DoubleBass)\
**Post date:** [1 March 2023 07:28 UTC](https://forum.dynare.org/t/how-to-calculate-cumulative-effects/22021/2 "2023-03-01T07:28:44Z")

</div>

I guess you are looking for the cumulative sum of the effects of a shock on a variable. In that case run a stochastic simulation with the shock in question and then use something along the lines of: `cumsum(oo_.irfs.Variable_Shock)`
