# Can't work with third order

**URL:** <https://forum.dynare.org/t/cant-work-with-third-order/10523>\
**Category:** Stochastic simulations\
**Created:** [7 August 2017 12:32 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523 "2017-08-07T12:32:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tianyuwuhe](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/87869e/32.png) [@tianyuwuhe](https://forum.dynare.org/u/tianyuwuhe)\
**Post date:** [7 August 2017 12:32 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/1 "2017-08-07T12:32:32Z")

</div>

Hi, I can’t stoch\_simul a mod file with third order perturbation in 4.5.1 version(while no problem when order=2), but can run correctly in 4.4.3 version. Can anyone help me with this?

---

<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:** [7 August 2017 13:24 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/2 "2017-08-07T13:24:30Z")

</div>

Hi, Can you post the error message and the mod file?

Best,  
Stéphane.

---

<div class="post-metadata">

**Author:** ![tianyuwuhe](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/87869e/32.png) [@tianyuwuhe](https://forum.dynare.org/u/tianyuwuhe)\
**Post date:** [8 August 2017 05:18 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/3 "2017-08-08T05:18:12Z")

</div>

Dear Stéphane  
Thank you for your help, I am trying to do a third order perturbation as you would see from the attached code(from our forum)in Dynare 5.1.1. When I run the model with order=3, Matlab exits automatically without any hints after the computer screen shows the steady state value. However, the program with order=2 works normally in Dynare 5.1.1. In addition, I run the mod file with order=3 or order=2 successfully in Dynare 4.4.3. Surprisingly, all the model files with order=3 have similar experience in my Dynare 5.1.1. Now I am quite confused the problem why the mod file can’t work well in 5.1.1. By the way I use Matlab version 2014a in my computer. I think something is wrong with my computer system, but I don’t know what to do about it.Really appreciate your help.  
Regards  
Feng  
[deficit\_sticky.mod](https://forum.dynare.org/uploads/default/original/2X/3/396e04f9604681d17fa37ca34786fc84554c73f5.mod) (4.7 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [8 August 2017 07:09 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/4 "2017-08-08T07:09:27Z")

</div>

@tianyuwuhe That is strange. I cannot reproduce the problem on my machine. Are you using Windows 10?

---

<div class="post-metadata">

**Author:** ![tianyuwuhe](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/87869e/32.png) [@tianyuwuhe](https://forum.dynare.org/u/tianyuwuhe)\
**Post date:** [9 August 2017 10:12 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/5 "2017-08-09T10:12:19Z")

</div>

Dear professor  
thanks a lot for your reply, I am using Windows 7 and my friend got the same results as you with Windows 10. Is it because of my low operating system version?

best,  
Feng

---

<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:** [9 August 2017 11:22 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/6 "2017-08-09T11:22:07Z")

</div>

Could you post the log file generated by Matlab? When Matlab crashes a log file called `matlab_crash_dump.XXXX` is saved on the disk, I do not know where on windows machines. Also, did you try with Octave? This could help in determining if it is a pure Matlab issue or Windows issue.

Best,  
Stéphane.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [9 August 2017 12:37 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/7 "2017-08-09T12:37:50Z")

</div>

Also, could you please check whether there is a `*.jnl`-file created in the folder. If yes, please post it here.

---

<div class="post-metadata">

**Author:** ![tlin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tlin](https://forum.dynare.org/u/tlin)\
**Post date:** [9 August 2017 19:51 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/8 "2017-08-09T19:51:51Z")

</div>

I am encountering the same issue.

I have a .mod file that had worked in 4.4.3 with a third-order perturbation solver but no longer works with 4.5.1.

It still works with order=1 option.

I have attempted to run my file in both a Windows 7 machine and a Mac with macOS Sierra. My MATLAB is R2016b. With Windows, MATLAB simply crashes as tianyuwuhe’s experience. On the Mac I get the following error message:

```
Invalid MEX-file '/Applications/Dynare/4.5.0/matlab/../mex/matlab/osx/k_order_perturbation.mexmaci64':
dlopen(/Applications/Dynare/4.5.0/matlab/../mex/matlab/osx/k_order_perturbation.mexmaci64, 6): Library not
loaded: @rpath/libhdf5.6.dylib
  Referenced from: /Applications/Dynare/4.5.0/mex/matlab/osx/k_order_perturbation.mexmaci64
  Reason: image not found.

```

(As you can see, I have tried with 4.5.0 as well.)

Tim

---

<div class="post-metadata">

**Author:** ![tianyuwuhe](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/87869e/32.png) [@tianyuwuhe](https://forum.dynare.org/u/tianyuwuhe)\
**Post date:** [10 August 2017 09:16 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/9 "2017-08-10T09:16:45Z")

</div>

HI,dear experts:  
Following your advice ,I found the log file generated when Matlab crashed, also I discoverd two facts using Dynare 4.5.1 diffent from using Dynare 4.4.3. First, aftering running the model using Dynare 4.5.1, there is an file named checksum which isn’t generated in Dynare 4.4.3. Second.aftering running the model using Dynare 4.5.1 first with order=3,Dynare didn’t automatically add any required subfolders in the matlab’s path,and the error hint in error.bmp shows up sometimes.Here is the attachment[attachment.zip](https://forum.dynare.org/uploads/default/original/2X/9/98b44d96fbe2aad1d827eab24025d04e5c40c71b.zip) (17.3 KB). I think something is wrong with my Matlab,but don’t know what to do about it. Thank for your patient reply.  
best,  
Feng  
.

---

<div class="post-metadata">

**Author:** ![tlin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tlin](https://forum.dynare.org/u/tlin)\
**Post date:** [15 August 2017 12:28 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/10 "2017-08-15T12:28:53Z")

</div>

Hi Feng,

Have you had any luck resolving the issue?

@jpfeifer: Given that this is an issue that appears across platforms, might there be a bug in Dynare such that it works for first-order solution, but not with second- or third-order?

Thanks,  
Tim

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [15 August 2017 14:23 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/11 "2017-08-15T14:23:20Z")

</div>

@tlin Your mac problem is one with building the mex-files. It is different from the crash on Windows. Our developer dealing with Macs will hopefully get back to you soon.

@tlin and @tianyuwuhe For Windows, as I said

> [@jpfeifer](#):
>
> could you please check whether there is a \*.jnl-file created in the folder. If yes, please post it here.

What puzzles me is that I can run the respective file at third order on Windows 10, 64bit, Dynare 4.5.1. Could you please try what happens if you run

```auto
stoch_simul (order=3, pruning, nocorr, nomoments, irf=12,irf_shocks=(epsh));

```

i.e. only request the IRF to a single shock.

---

<div class="post-metadata">

**Author:** ![tlin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tlin](https://forum.dynare.org/u/tlin)\
**Post date:** [15 August 2017 16:32 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/12 "2017-08-15T16:32:32Z")

</div>

Thank you, @jpfeifer, for the response!

I have run @tianyuwuhe’s model and reproduced the error. The resulting jnl is attached in the zip file. Note that Dynare/MATLAB crashes running either the model with just one single shock or all shocks.

[deficit\_sticky.zip](https://forum.dynare.org/uploads/default/original/2X/8/8df93910cae0ebdafbf39a5bd2ae5b5970206236.zip) (1.3 KB)

Thanks,  
Tim

---

<div class="post-metadata">

**Author:** ![tlin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tlin](https://forum.dynare.org/u/tlin)\
**Post date:** [15 August 2017 16:41 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/13 "2017-08-15T16:41:30Z")

</div>

I have attached the dump file below.

[matlab\_crash\_dump.zip](https://forum.dynare.org/uploads/default/original/2X/6/6289ecf5016810cd4c661d8063423af88f2e0083.zip) (1.3 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [15 August 2017 19:52 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/14 "2017-08-15T19:52:12Z")

</div>

I opened a ticket at [https://github.com/DynareTeam/dynare/issues/1490](https://github.com/DynareTeam/dynare/issues/1490)  
Could you please check which version of `C:\Windows\system32\msvcrt.dll` you have on your machine. You should be able to find this info in the file details in the Windows Explorer

---

<div class="post-metadata">

**Author:** ![tlin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tlin](https://forum.dynare.org/u/tlin)\
**Post date:** [16 August 2017 13:28 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/15 "2017-08-16T13:28:16Z")

</div>

I apologize for the delay.

The msvcrt.dll version is 7.0.7601.17744.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [16 August 2017 18:06 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/16 "2017-08-16T18:06:10Z")

</div>

Mine is 7.0.15063.0. What is the latest Visual C++ Redistributable on your machine? Mine in 2015.

---

<div class="post-metadata">

**Author:** ![tlin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tlin](https://forum.dynare.org/u/tlin)\
**Post date:** [16 August 2017 18:34 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/17 "2017-08-16T18:34:00Z")

</div>

According to Control Panel, it is 2015, 14.0.23506.

---

<div class="post-metadata">

**Author:** ![tlin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tlin](https://forum.dynare.org/u/tlin)\
**Post date:** [16 August 2017 18:36 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/18 "2017-08-16T18:36:43Z")

</div>

To clarify, the machine has MS Visual C++ 2015 Redistributable (x64) - 14.0.23506.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [16 August 2017 19:11 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/19 "2017-08-16T19:11:16Z")

</div>

Could you please try reinstalling it? My version is 14.0.23918

---

<div class="post-metadata">

**Author:** ![tlin](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/3da27b/32.png) [@tlin](https://forum.dynare.org/u/tlin)\
**Post date:** [16 August 2017 19:28 UTC](https://forum.dynare.org/t/cant-work-with-third-order/10523/20 "2017-08-16T19:28:44Z")

</div>

I have just installed the latest update of MS Visual C++ 2015 Redistributable; it is now 14.0.24212.

However, my msvcrt.dll has not changed; it is still version 7.0.7601.17744.

I am attaching the .jnl after MATLAB crashes. It did not generate a dump file.

[deficit\_sticky.zip](https://forum.dynare.org/uploads/default/original/2X/8/863510b165bcec15b27f51f166b7efbe80f24b41.zip) (2.4 KB)

[Next page](https://forum.dynare.org/t/cant-work-with-third-order/10523.md?page=2)
