# Output gap estimation

**URL:** <https://forum.dynare.org/t/output-gap-estimation/6364>\
**Category:** Dynare help (legacy posts)\
**Created:** [20 July 2017 08:47 UTC](https://forum.dynare.org/t/output-gap-estimation/6364 "2017-07-20T08:47:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ecepilova](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/eada6e/32.png) [@Ecepilova](https://forum.dynare.org/u/Ecepilova)\
**Post date:** [20 July 2017 08:47 UTC](https://forum.dynare.org/t/output-gap-estimation/6364/1 "2017-07-20T08:47:11Z")

</div>

Hi,

I am trying to estimate output gap with a very simple model, but i meet the following error:

[quote]Error using +  
Matrix dimensions must agree.

Error in prior\_posterior\_statistics\_core (line 274)  
stock\_filter\_step\_ahead(ii,IdObs,:,irun(4)) =  
squeeze(stock\_filter\_step\_ahead(ii,IdObs,:,irun(4)))…

Error in prior\_posterior\_statistics (line 241)  
[fout] = prior\_posterior\_statistics\_core(localVars,1,B,0);

Error in dynare\_estimation\_1 (line 520)  
prior\_posterior\_statistics(‘posterior’,dataset\_,dataset\_info);

Error in dynare\_estimation (line 105)  
dynare\_estimation\_1(var\_list,dname);

Error in t (line 145)  
oo\_recursive\_=dynare\_estimation(var\_list\_);

Error in dynare (line 223)  
evalin(‘base’,fname) ;[/quote]

Could anyone help me with this? Tanks a lot!

Best,  
Elizaveta  
[t.mod](https://forum.dynare.org/uploads/default/original/2X/c/c482ba2747f602e2ac9cfe76a70b3cfdabd74761.mod) (677 Bytes)  
[data\_i.m](https://forum.dynare.org/uploads/default/original/2X/b/bcb86b93b89b5f9a1281bb8c4b05e04807be8fe1.m) (1.68 KB)

---

<div class="post-metadata">

**Author:** ![stepan-a](https://forum.dynare.org/user_avatar/forum.dynare.org/stepan-a/32/6652_2.png) [@stepan-a](https://forum.dynare.org/u/stepan-a)\
**Post date:** [20 July 2017 09:59 UTC](https://forum.dynare.org/t/output-gap-estimation/6364/2 "2017-07-20T09:59:54Z")

</div>

Dear Elizaveta,

This is most likely a bug when we add back the trend in the filtered variables. Could you please try by replacing the file prior\_posterior\_statistics\_core.m in the Matlab subfolder by the one attached to this post. Also I rewrote (and renamed) the mod file. Please confirm if these files fix the issue (we will then release the patch in 4.5.1).

Best,  
Stéphane.  
[prior\_posterior\_statistics\_core.m](https://forum.dynare.org/uploads/default/original/2X/4/4065c364314508daeb33d3c450907b2a5c019ef3.m) (21.4 KB)  
[example.mod](https://forum.dynare.org/uploads/default/original/2X/7/7ae7e7e0b3082a0a89f4b7f8a806f37340a443cd.mod) (683 Bytes)

---

<div class="post-metadata">

**Author:** ![Ecepilova](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/eada6e/32.png) [@Ecepilova](https://forum.dynare.org/u/Ecepilova)\
**Post date:** [20 July 2017 10:11 UTC](https://forum.dynare.org/t/output-gap-estimation/6364/3 "2017-07-20T10:11:32Z")

</div>

Dear Stéphane,

Running your example.mod file repeats the same error. New file solves the problem! Thanks a lot.

Best,  
Elizaveta

---

<div class="post-metadata">

**Author:** ![stepan-a](https://forum.dynare.org/user_avatar/forum.dynare.org/stepan-a/32/6652_2.png) [@stepan-a](https://forum.dynare.org/u/stepan-a)\
**Post date:** [20 July 2017 10:58 UTC](https://forum.dynare.org/t/output-gap-estimation/6364/4 "2017-07-20T10:58:19Z")

</div>

Thanks Elizaveta. I need to check that the patch does not cause problems elsewhere… If not, it will be in 4.5.1 bug fix release (to be published next week).

Best,  
Stéphane.
