Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple MCMC chains trigger an error #61

Open
MichelJuillard opened this issue Jan 23, 2024 · 0 comments
Open

multiple MCMC chains trigger an error #61

MichelJuillard opened this issue Jan 23, 2024 · 0 comments

Comments

@MichelJuillard
Copy link
Member

The error is the following

julia> @time dynare("nk_est_a","stoponerror");
Dynare version: 0.9.1
2024-01-23T15:35:35.551: Starting @dynare nk_est_a
["nk_est_a.mod", "language=julia", "json=compute"]
Dynare preprocessor version: 6.4.0+0
Starting preprocessing of the model file ...
Found 8 equation(s).
Evaluating expressions...
Computing static model derivatives (order 1).
Normalizing the static model...
Finding the optimal block decomposition of the static model...
5 block(s) found:
  4 recursive block(s) and 1 simultaneous block(s).
  the largest simultaneous block has 3 equation(s)
                                 and 3 feedback variable(s).
Computing dynamic model derivatives (order 2).
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 3 equation(s)
                                 and 3 feedback variable(s).
JSON written after Computing step.
Preprocessing completed.

2024-01-23T15:35:35.643: End of preprocessing
2024-01-23T15:35:37.696: Start parse_statements!
ERROR: Unrecognized statement native rwmh_compute!(datafile="dsge1_data.csv", mcmc_replic=100000, mcmc_jscale=0.03, mcmc_chains=2, transformed_parameters=false, initial_values=context.work.estimated_parameters.initialvalue);
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] parse_statements!(context::Context, statements::Vector{Any})
   @ Dynare ~/projects/DynareJulia/Dynare.jl/src/DynareParser.jl:287
 [3] parser(modfilename::String, commandlineoptions::Dynare.CommandLineOptions)
   @ Dynare ~/projects/DynareJulia/Dynare.jl/src/DynareParser.jl:224
 [4] dynare(modfile_arg::String, args::String)
   @ Dynare ~/projects/DynareJulia/Dynare.jl/src/Dynare.jl:103
 [5] macro expansion
   @ ./timing.jl:279 [inlined]
 [6] top-level scope
   @ ./REPL[5]:1

caused by: TaskFailedException

    nested task error: TaskFailedException
    
        nested task error: MethodError: no method matching MCMCChains.Chains(::Vector{…}, ::Vector{…}, ::@NamedTuple{…}; start::Int64, thin::Int64)
        
        Closest candidates are:
          MCMCChains.Chains(::AbstractArray{<:Union{Missing, Real}, 3}, ::AbstractVector{Symbol}, ::Any; start, thin, iterations, evidence, info)
           @ MCMCChains ~/.julia/packages/MCMCChains/AQENn/src/chains.jl:28
          MCMCChains.Chains(::AbstractVector{<:AbstractVector{<:Union{Missing, Real}}}, ::Any...; kwargs...)
           @ MCMCChains ~/.julia/packages/MCMCChains/AQENn/src/chains.jl:6
          MCMCChains.Chains(::AbstractVector{<:Union{Missing, Real}}, ::Any...; kwargs...)
           @ MCMCChains ~/.julia/packages/MCMCChains/AQENn/src/chains.jl:10
          ...
        
        Stacktrace:
         [1] bundle_samples(ts::Vector{…}, model::AbstractMCMC.LogDensityModel{…}, sampler::AdvancedMH.MetropolisHastings{…}, state::AdvancedMH.Transition{…}, chain_type::Type{…}; discard_initial::Int64, thinning::Int64, param_names::Vector{…}, kwargs::@Kwargs{…})
           @ AdvancedMHMCMCChainsExt ~/.julia/packages/AdvancedMH/Yiy0x/ext/AdvancedMHMCMCChainsExt.jl:35
         [2] mcmcsample(rng::Random.TaskLocalRNG, model::AbstractMCMC.LogDensityModel{…}, sampler::AdvancedMH.MetropolisHastings{…}, N::Int64; progress::Bool, progressname::String, callback::Nothing, discard_initial::Int64, thinning::Int64, chain_type::Type, initial_state::Nothing, kwargs::@Kwargs{…})
           @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:195
         [3] mcmcsample
           @ ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:95 [inlined]
         [4] #sample#17
           @ ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:51 [inlined]
         [5] sample
           @ ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:44 [inlined]
         [6] (::AbstractMCMC.var"#32#45"{…})()
           @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:387
    
    ...and 1 more exception.
    
    Stacktrace:
     [1] sync_end(c::Channel{Any})
       @ Base ./task.jl:448
     [2] macro expansion
       @ ./task.jl:480 [inlined]
     [3] (::AbstractMCMC.var"#31#44"{…})()
       @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:361
Stacktrace:
  [1] sync_end(c::Channel{Any})
    @ Base ./task.jl:448
  [2] macro expansion
    @ ./task.jl:480 [inlined]
  [3] macro expansion
    @ ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:339 [inlined]
  [4] macro expansion
    @ ~/.julia/packages/ProgressLogging/6KXlp/src/ProgressLogging.jl:328 [inlined]
  [5] macro expansion
    @ ~/.julia/packages/AbstractMCMC/Es490/src/logging.jl:9 [inlined]
  [6] mcmcsample(rng::Random.TaskLocalRNG, model::AbstractMCMC.LogDensityModel{…}, sampler::AdvancedMH.MetropolisHastings{…}, ::AbstractMCMC.MCMCThreads, N::Int64, nchains::Int64; progress::Bool, progressname::String, initial_params::FillArrays.Fill{…}, initial_state::Nothing, kwargs::@Kwargs{…})
    @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:333
  [7] mcmcsample
    @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:292 [inlined]
  [8] #sample#19
    @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:90 [inlined]
  [9] sample
    @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:81 [inlined]
 [10] #sample#86
    @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/logdensityproblems.jl:73 [inlined]
 [11] sample
    @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/logdensityproblems.jl:64 [inlined]
 [12] #sample#18
    @ AbstractMCMC ~/.julia/packages/AbstractMCMC/Es490/src/sample.jl:62 [inlined]
 [13] run_mcmc(posterior_density::Dynare.DSGELogPosteriorDensity{…}, initial_values::Vector{…}, proposal_covariance::Matrix{…}, param_names::Vector{…}, mcmc_replic::Int64, mcmc_chains::Int64)
    @ Dynare ~/projects/DynareJulia/Dynare.jl/src/estimation/estimation.jl:1029
 [14] mh_estimation(context::Context, observations::LinearAlgebra.Transpose{…}, obsvarnames::Vector{…}, initial_values::Vector{…}; covariance::Matrix{…}, back_transformation::Bool, first_obs::Int64, last_obs::Int64, mcmc_chains::Int64, mcmc_replic::Int64, transformed_covariance::Matrix{…}, transformed_parameters::Bool, kwargs::@Kwargs{})
    @ Dynare ~/projects/DynareJulia/Dynare.jl/src/estimation/estimation.jl:1005
 [15] rwmh_compute!(; context::Context, back_transformation::Bool, datafile::String, data::AxisArrayTables.AxisArrayTable{…}, diffuse_filter::Bool, display::Bool, fast_kalman_filter::Bool, first_obs::Int64, initial_values::Vector{…}, covariance::Matrix{…}, transformed_covariance::Matrix{…}, last_obs::Int64, mcmc_chains::Int64, mcmc_init_scale::Float64, mcmc_jscale::Float64, mcmc_replic::Int64, mode_compute::Bool, nobs::Int64, order::Int64, plot_chain::Bool, plot_posterior_density::Bool, presample::Int64, transformed_parameters::Bool)
    @ Dynare ~/projects/DynareJulia/Dynare.jl/src/estimation/estimation.jl:251
 [16] top-level scope
    @ none:1
Some type information was truncated. Use `show(err)` to see complete types.
  • maybe a recent change in AdvancedMH.jl call to sample() with several chains?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant