[ANN] Dynare.jl is now ready for testing

Dynare.jl (GitHub - DynareJulia/Dynare.jl: A Julia rewrite of Dynare: solving, simulating and estimating DSGE models.), a Julia rewriting of Dynare,
is now ready for testing by users. Dynare is a software for solving,
simulating and estimating Dynamic Stochastic General Equilibrium
(DSGE) models widely used in macroeconomics.

The following features are implemented: steady state, local
approximation of the solution at 1st and 2nd order,
perfect foresight simulations, forecasting, optimal policy.

Documentation is available at https://DynareJulia.github.io/Dynare.jl

Thank you for reporting any error, question or desired additional feature.

27 Likes

Nice package ! Considering the post about the β€œ1.5 language” and the original Matlab version of dynare, I was wondering about your opinion on this Matlab to Julia reimplementation :slightly_smiling_face:

4 Likes

Thanks very much for this project, I am looking forward to using it.

With the current version (0.9.11), I can run the simple RBC estimation example from Estimation problem in Julia - Dynare Julia - Dynare Forum without errors, but I can’t find the estimation results anywhere. I looked inside the context structure, as well as in the subdirectories that are created. Is this expected with 0.9.11?

Dear Michael,

thank you for reporting the problem. There is obviously something broken in v0.9.11 with estimation. I will release a correction soon.

Note the error message at the end of the run:

ArgumentError("matrix contains Infs or NaNs")

Best

Michel

OK, thanks. I will try to test various things in the future.

Dear @mcreel ,

I just released Dynare v0.9.12 that should solve the problems with the estimation code.
Just update your environment:

] update

You may have to restart Julia.
I modify the . mod file so that you see the first order approximation results
See DynareJulia estimation example used in https://forum.dynare.org/t/estimation-problem-in-julia/25412 and https://discourse.julialang.org/t/ann-dynare-jl-is-now-ready-for-testing/108177/4 Β· GitHub

1 Like

Hi Michel,
Thanks, it seems to be working well now! Inside context.results, I find

estimation: Dynare.EstimationResults([0.9208808863932328, 0.04441817638943685], [2.454376213054909, -3.114106515175857], [0.03408840700653537, 0.011260134441262335], [0.4220899442337999, 0.22912707304878288], [0.0011620194922432098 -0.00036399187020596423; -0.00036399187020596423 0.00012679062763530226], [0.17815992102329234 -0.09061689673115145; -0.09061689673115145 0.052499215603902284], 0)

which seems to be the estimation output. I don’t know quite how to interpret it, but the estimation seems to work. Am I supposed to see a nice table of estimated coefficients, standard devs., etc., as in Dynare on Octave? That is not appearing.

Next week, I will try MCMC, etc…

Thanks!

That is very strange. I get the following output. The estimation results are at the end of the log:

julia> context = @dynare "RBCmj1";
Dynare version: 0.9.12
2024-05-25T19:22:41.091: Starting @dynare RBCmj1
["RBCmj1.mod", "language=julia", "json=compute"]
Dynare preprocessor version: 6.4.0+0
Starting preprocessing of the model file ...
Found 9 equation(s).
Evaluating expressions...
Computing static model derivatives (order 1).
Normalizing the static model...
Finding the optimal block decomposition of the static model...
3 block(s) found:
  2 recursive block(s) and 1 simultaneous block(s).
  the largest simultaneous block has 7 equation(s)
                                 and 5 feedback variable(s).
Computing dynamic model derivatives (order 1).
Normalizing the dynamic model...
Finding the optimal block decomposition of the dynamic model...
3 block(s) found:
  2 recursive block(s) and 1 simultaneous block(s).
  the largest simultaneous block has 7 equation(s)
                                 and 6 feedback variable(s).
JSON written after Computing step.
Preprocessing completed.

2024-05-25T19:22:41.121: End of preprocessing
2024-05-25T19:22:41.152: Start parse_statements!
  Steady state

───────┬─────────
   Y   β”‚ 1.21132
     C β”‚  0.9094
     K β”‚ 12.0783
     L β”‚  0.3511
     A β”‚     1.0
     R β”‚  0.0351
     W β”‚  2.2423
     I β”‚   0.302
 OBS_C β”‚     0.0
───────┴─────────



  Coefficients of approximate solution function (reduced form)

─────────┬────────────────────────────────────────────────────────────────────────────
         β”‚  Y_t     C_t     K_t      L_t     A_t        R_t     W_t      I_t  OBS_C_t
──────────────────────────────────────────────────────────────────────────────────────
    Ο•(C) β”‚   -0.0    -0.0     0.0      0.0     0.0     -0.0     0.0     -0.0  -1.0997
    Ο•(K) β”‚ 0.0188  0.0431  0.9507  -0.0073     0.0  -0.0024  0.0812  -0.0243   0.0474
    Ο•(A) β”‚ 1.6994  0.2401  1.4593   0.2595  0.9226   0.0492  1.4888   1.4593    0.264
 eps_A_t β”‚  1.842  0.2602  1.5818   0.2813     1.0   0.0534  1.6137   1.5818   0.2862
─────────┴────────────────────────────────────────────────────────────────────────────

  Note: Ο•(x) = x_{t-1} - steady_state(x)



  THEORETICAL MOMENTS

──────────┬──────────────────────────────
 VARIABLE β”‚  MEAN    STD. DEV.  VARIANCE
─────────────────────────────────────────
        Y β”‚  1.2113     0.2381    0.0567
        C β”‚  0.9094     0.1181     0.014
        K β”‚ 12.0783     2.2739    5.1705
        L β”‚  0.3511     0.0259    0.0007
        A β”‚     1.0     0.1141     0.013
        R β”‚  0.0351     0.0052       0.0
        W β”‚  2.2423     0.3294    0.1085
        I β”‚   0.302      0.154    0.0237
    OBS_C β”‚     0.0     0.0136    0.0002
──────────┴──────────────────────────────



  VARIANCE DECOMPOSITION (in percent)

──────────┬───────
 VARIABLE β”‚ eps_A
──────────────────
        Y β”‚   1.0
        C β”‚   1.0
        K β”‚   1.0
        L β”‚   1.0
        A β”‚   1.0
        R β”‚   1.0
        W β”‚   1.0
        I β”‚   1.0
    OBS_C β”‚   1.0
──────────┴───────



  CORRELATION MATRIX

───────┬───────────────────────────────────────────────────────────────────────────
       β”‚   Y        C        K       L       A        R       W       I     OBS_C
───────────────────────────────────────────────────────────────────────────────────
     Y β”‚    1.0   0.8339   0.7491  0.7759  0.9895   0.4311  0.9485   0.906  0.4678
     C β”‚ 0.8339      1.0   0.9903  0.2989  0.7455  -0.1385  0.9658  0.5219  0.0523
     K β”‚ 0.7491   0.9903      1.0  0.1634  0.6457  -0.2748  0.9204  0.3983  -0.055
     L β”‚ 0.7759   0.2989   0.1634     1.0  0.8589   0.9037  0.5362    0.97  0.7491
     A β”‚ 0.9895   0.7455   0.6457  0.8589     1.0   0.5568  0.8929  0.9576  0.5513
     R β”‚ 0.4311  -0.1385  -0.2748  0.9037  0.5568      1.0   0.123  0.7725  0.7539
     W β”‚ 0.9485   0.9658   0.9204  0.5362  0.8929    0.123     1.0  0.7252  0.2499
     I β”‚  0.906   0.5219   0.3983    0.97  0.9576   0.7725  0.7252     1.0  0.6829
 OBS_C β”‚ 0.4678   0.0523   -0.055  0.7491  0.5513   0.7539  0.2499  0.6829     1.0
───────┴───────────────────────────────────────────────────────────────────────────



  AUTOCORRELATION COEFFICIENTS

───────┬────────────────────────────────────────
       β”‚   1       2       3       4       5
────────────────────────────────────────────────
     Y β”‚ 0.9403  0.8843  0.8318  0.7826  0.7365
     C β”‚ 0.9945  0.9859  0.9746   0.961  0.9454
     K β”‚  0.998  0.9924  0.9837  0.9723  0.9586
     L β”‚ 0.8773  0.7664  0.6662  0.5757  0.4942
     A β”‚ 0.9226  0.8512  0.7853  0.7245  0.6684
     R β”‚ 0.8867  0.7839  0.6907  0.6064  0.5301
     W β”‚ 0.9764   0.952  0.9269  0.9014  0.8756
     I β”‚ 0.8919  0.7937  0.7046  0.6237  0.5504
 OBS_C β”‚ 0.2849  0.2469  0.2126  0.1817   0.154
───────┴────────────────────────────────────────

 * Status: success

 * Candidate solution
    Final objective value:     -2.243469e+02

 * Found with
    Algorithm:     BFGS

 * Convergence measures
    |x - x'|               = 2.33e-02 β‰° 0.0e+00
    |x - x'|/|x'|          = 7.47e-03 β‰° 0.0e+00
    |f(x) - f(x')|         = 1.80e-03 β‰° 0.0e+00
    |f(x) - f(x')|/|f(x')| = 8.03e-06 ≀ 1.0e-05
    |g(x)|                 = 5.74e-01 β‰° 1.0e-08

 * Work counters
    Seconds run:   0  (vs limit Inf)
    Iterations:    2
    f(x) calls:    5
    βˆ‡f(x) calls:   5

  Posterior mode

────────────┬──────────────────────────────────────────────────────────
 Parameter  β”‚ Estimated value  Standard error  80% confidence interval
───────────────────────────────────────────────────────────────────────
       rhoA β”‚          0.9209          0.0341         0.8772 .. 0.9645
 Std(eps_A) β”‚          0.0444          0.0113           0.03 .. 0.0588
────────────┴──────────────────────────────────────────────────────────

2024-05-25T19:22:50.589: End parse_statements!
2024-05-25T19:22:50.589: End parser
2 Likes

I simply forgot the semicolon at the end of

context = @dynare "RBCmj1";

With that, everything is fine. Many thanks!

Edit: running it on my own model, I can say that it is impressively fast compared to Dynare on Octave.

:+1:

Do you prefer questions about Dynare.jl here, or on the Dynare forum? I do have a few questions.

Regarding testing, I have done MCMC, order=1, with a model of my own, no problems.

Both are OK for me, but for the users it would be better to have them in a single place. Let’s have the questions on the Dynare forum (https://forum.dynare.org).
If the question or the suggestion is more about the Julia implementation then maybe they are better here, but each question should have its own thread. Looking forward to your input.
You are also welcome to PM me

1 Like