How to obtain estimation results from context?

Many thanks for the Julia version of Dynare, it is a pleasure to be using Dynare from Julia!

I am interested in running some Monte Carlo experiments, and I would like to access the estimated parameters in Julia, after doing maximum posterior or MCMC.

Starting with maximum posterior, I can see the estimated parameters in the context.results structure, but I can’t find a way to pull out the estimated parameter vector, to use in Julia. Similarly, for MCMC, I don’t see a way to access the posterior quantiles or the raw chain.


Actually, studying the source code for the estimation function, I see it now, in part:

results = context.results.model_results[1]
julia> results.estimation.posterior_mode
7-element Vector{Float64}:

I don’t find the posterior quantiles or the raw chains, however. Perhaps they are not saved?

Sorry, currently there is no accessor functions to access the estimation results.

When the posterior mode is computed, the following fields are available in context.results.model_results[1].estimation

  • posterior_mode
  • posterior_mode_std
  • posterior_mode_covariance
    By default, the optimization is done with transformed_parameters set to true and the parameters whose prior takes its value on a subset of R are transformed so as take their value on R.
    When transformed_parameters is true, in addition, the following results are stored:
  • transformed_posterior_mode
  • transformed_posterior_mode_std
  • transformed_posterior_mode_covariance

Currently we only store the MCMC chains in <modname>/output/mcm_chain_N.jls where N starts at one and increase every time that you run estimation or rwmc_compute!() for the same model (actually with the same context).
You can recover the chain with

using Serialization
C = deserialize("<modname>/output/mcm_chain_1.jls")

for example.

Please open another issue to request accessor functions for estimation results.