Extending BeforeIT using macros and multiple dispatch

Extension by Specialization

import BeforeIT as Bit
using Plots

When extending the BeforeIT model it is required to first create a new model type to use instead of the default model, we can do so by using

Bit.@object struct NewModel(Bit.Model) <: Bit.AbstractModel end

In BeforeIT, new objects can be created to add new behaviours. For instance, we can define a new central bank object with one extra attribute

Bit.@object mutable struct NewCentralBank(Bit.CentralBank) <: Bit.AbstractCentralBank
    fixed_rate::Float64
end

and then change the default central bank behaviour for the new type

function Bit.central_bank_rate(cb::NewCentralBank, model::Bit.AbstractModel)
    return cb.fixed_rate
end

Now, we can initialize the model to include the new type, to do so, we will need to initialize all model components first

p, ic = Bit.AUSTRIA2010Q1.parameters, Bit.AUSTRIA2010Q1.initial_conditions
firms = Bit.Firms(p, ic)
w_act, w_inact = Bit.Workers(p, ic)
cb = Bit.CentralBank(p, ic)
bank = Bit.Bank(p, ic)
government = Bit.Government(p, ic)
rotw = Bit.RestOfTheWorld(p, ic)
agg = Bit.Aggregates(p, ic)
properties = Bit.Properties(p, ic)
data = Bit.Data()
BeforeIT.Data(Int64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Float64[], Vector{Float64}[], Vector{Float64}[])

And then initialize a new central bank with the same fields as the original one, and the fixed interest rate

new_cb = NewCentralBank(Bit.fields(cb)..., 0.02)

std_model = Bit.Model((w_act, w_inact, firms, bank, cb, government, rotw, agg, properties, data))
new_model = NewModel((w_act, w_inact, firms, bank, new_cb, government, rotw, agg, properties, data))
Main.NewModel{BeforeIT.Workers, BeforeIT.Workers, BeforeIT.Firms, BeforeIT.Bank, Main.NewCentralBank, BeforeIT.Government, BeforeIT.RestOfTheWorld, BeforeIT.Aggregates, BeforeIT.Properties, BeforeIT.Data}(BeforeIT.Workers(Base.RefValue{Bool}(false), Base.RefValue{Int64}(4118), Dict{Int64, Int64}(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118], [0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249  …  4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569], [3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487  …  22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958], [6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249  …  42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032], [0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983  …  11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522], [1, 1, 1, 1, 2, 3, 3, 3, 4, 5  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), BeforeIT.Workers(Base.RefValue{Bool}(false), Base.RefValue{Int64}(4130), Dict{Int64, Int64}(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130], [2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714  …  2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714], [0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457  …  0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457, 0.00031353221573136457], [0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219  …  0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219, 0.0005781392809499219], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1  …  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), BeforeIT.Firms(Base.RefValue{Bool}(false), Base.RefValue{Int64}(624), Dict{Int64, Int64}(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  615, 616, 617, 618, 619, 620, 621, 622, 623, 624], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1  …  62, 62, 62, 62, 62, 62, 62, 62, 62, 62], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951], [1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485  …  3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877], [0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754  …  0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983  …  2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687], [0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721  …  0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782], [0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832  …  0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318], [-0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635  …  0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037], [4, 1, 3, 1, 1, 3, 1, 1, 2, 1  …  7, 2, 3, 24, 1, 1, 2, 2, 1, 4], [43.288106637226484, 10.822026659306621, 32.46607997791986, 10.822026659306621, 10.822026659306621, 32.46607997791986, 10.822026659306621, 10.822026659306621, 21.644053318613242, 10.822026659306621  …  83.91672371809265, 23.976206776597902, 35.96431016489685, 287.7144813191748, 11.988103388298951, 11.988103388298951, 23.976206776597902, 23.976206776597902, 11.988103388298951, 47.952413553195804], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [43.288106637226484, 10.822026659306621, 32.46607997791986, 10.822026659306621, 10.822026659306621, 32.46607997791986, 10.822026659306621, 10.822026659306621, 21.644053318613242, 10.822026659306621  …  83.91672371809265, 23.976206776597902, 35.96431016489685, 287.7144813191748, 11.988103388298951, 11.988103388298951, 23.976206776597902, 23.976206776597902, 11.988103388298951, 47.952413553195804], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [1192.6146341463414, 298.15365853658534, 894.460975609756, 298.15365853658534, 298.15365853658534, 894.460975609756, 298.15365853658534, 298.15365853658534, 596.3073170731707, 298.15365853658534  …  554.4583333333334, 158.41666666666669, 237.625, 1901.0, 79.20833333333334, 79.20833333333334, 158.41666666666669, 158.41666666666669, 79.20833333333334, 316.83333333333337], [30.6204570162942, 7.65511425407355, 22.965342762220647, 7.65511425407355, 7.65511425407355, 22.965342762220647, 7.65511425407355, 7.65511425407355, 15.3102285081471, 7.65511425407355  …  28.402406706429453, 8.114973344694128, 12.172460017041193, 97.37968013632954, 4.057486672347064, 4.057486672347064, 8.114973344694128, 8.114973344694128, 4.057486672347064, 16.229946689388257], [376.32296498432004, 94.08074124608001, 282.24222373824, 94.08074124608001, 94.08074124608001, 282.24222373824, 94.08074124608001, 94.08074124608001, 188.16148249216002, 94.08074124608001  …  174.95626666497967, 49.98750476142276, 74.98125714213413, 599.850057137073, 24.99375238071138, 24.99375238071138, 49.98750476142276, 49.98750476142276, 24.99375238071138, 99.97500952284553], [0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726  …  0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956], [49.53716821226806, 12.384292053067014, 37.152876159201035, 12.384292053067014, 12.384292053067014, 37.152876159201035, 12.384292053067014, 12.384292053067014, 24.76858410613403, 12.384292053067014  …  94.71078047616643, 27.06022299319041, 40.59033448978562, 324.72267591828495, 13.530111496595206, 13.530111496595206, 27.06022299319041, 27.06022299319041, 13.530111496595206, 54.12044598638082], [5.019381869905745, 1.2548454674764362, 3.7645364024293086, 1.2548454674764362, 1.2548454674764362, 3.7645364024293086, 1.2548454674764362, 1.2548454674764362, 2.5096909349528724, 1.2548454674764362  …  25.039745386588006, 7.154212967596575, 10.731319451394864, 85.85055561115891, 3.5771064837982873, 3.5771064837982873, 7.154212967596575, 7.154212967596575, 3.5771064837982873, 14.30842593519315], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [3.4538854703154467, 1.3061857958470844, 2.7379855788259926, 1.3061857958470844, 1.3061857958470844, 2.7379855788259926, 1.3061857958470844, 1.3061857958470844, 2.0220856873365385, 1.3061857958470844  …  14.875671212583667, 4.671824563850785, 6.712593893597363, 49.56874981827549, 2.631055234104207, 2.631055234104207, 4.671824563850785, 4.671824563850785, 2.631055234104207, 8.75336322334394], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0007059032678436237, 0.0002669575553746345, 0.0005595880303539607, 0.0002669575553746345, 0.0002669575553746345, 0.0005595880303539607, 0.0002669575553746345, 0.0002669575553746345, 0.00041327279286429756, 0.0002669575553746345  …  0.003040281737938197, 0.0009548250093287502, 0.0013719163550506399, 0.010130834615210318, 0.0005377336636068607, 0.0005377336636068607, 0.0009548250093287502, 0.0009548250093287502, 0.0005377336636068607, 0.0017890077007725292], [0.0003828202354549805, 0.00014477444553726425, 0.0003034716388157417, 0.00014477444553726425, 0.00014477444553726425, 0.0003034716388157417, 0.00014477444553726425, 0.00014477444553726425, 0.000224123042176503, 0.00014477444553726425  …  0.0016487830893918006, 0.000517813631896247, 0.0007440075233953581, 0.005494079244876686, 0.00029161974039713625, 0.00029161974039713625, 0.000517813631896247, 0.000517813631896247, 0.00029161974039713625, 0.0009702014148944687]), BeforeIT.Bank(89460.0, 6476.292527744362, 0.0, 33080.704167538745, 0.028359903595743693, 3695.3696336675234, 0.0, 0.0, 0.0, 0.0, 33636.12938055409, 18241.29672694816), Main.NewCentralBank(0.0016459319014481277, 0.0089810924595537, 0.9259668580654086, -0.003424572940686137, 0.0049629315732038215, 0.30996974466133875, 1.328593153520194, 106179.90000000002, 0.02), BeforeIT.Government(0.9905949533296431, 0.09373211872949586, 0.011235005057648862, 0.0, 14732.121510837034, 232610.9, 2.238468336136841, 0.5902859043576301, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0, 0.0), BeforeIT.RestOfTheWorld(0.962809216044625, 0.39260026877953946, 0.020320381298662014, 0.9662360466537488, 0.35492769963078624, 0.02122821278168188, 2.3548476e6, 0.0, 0.0019383188997990075, 0.38456173629534834, 0.0026219533879005877, 0.0025327891562467505, 0.9635784504324201, 0.5360029623199525, 0.006618207536795881, 0.0, 33097.63671130043, 34095.03119997918, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0), BeforeIT.Aggregates([104531.39273728609, 105062.38754395355, 105399.12953350678, 106689.88106040593, 107938.33111423723, 108890.48532381697, 110110.17779727321, 110374.00540561741, 110808.89423399912, 111932.48072916963  …  139382.61162744602, 141288.21877604182, 140554.06557898276, 139768.5198028018, 137144.71527593565, 135054.13194905635, 133851.32295827195, 134293.63309771818, 135709.0626505015, 134635.75553779321], [-0.007497362866886709, -0.007895434153021436, -0.0019938777296781562, -0.0035311300388783107, 0.001212170001002849, -0.001672412335241874, 0.001839696090252002, 0.004290005139261838, 0.00600429551344886, 0.0036060572293247772  …  0.010368416047796258, 0.005161476804794514, -0.0025695603517498014, 0.0006033009671786438, 0.013376536173073151, 0.005811645790062013, -0.0003164402217366337, 0.004034477127754229, 0.005303186518592234, 0.0010079589742698286], 1.0, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1), BeforeIT.Properties(62, 54, 4743, 4130, 156, 312, [48, 2, 1, 1, 5, 2, 4, 1, 1, 1  …  14, 10, 13, 41, 20, 16, 7, 7, 2, 19], 624, 8873, 0.21340742230566648, 0.07701197259426128, 0.1528683933530887, 0.21215146534992413, 0.17114894621657745, 0.0029486201783457183, 0.08761417854834112, 0.009147800682711324, 0.3585824478060919, 0.9096681249468772, 0.07125099957246343, 0.026713971694295565, 0.7858074440019603, 0.05, 0.03, 0.6, 0.5, [0.0033476048872100555, 0.0, 0.0, 0.0008050086095806136, 0.0, 0.003306696048303853, 0.0030629933432974495, 0.0, 0.0, 0.0  …  0.0017883064872300512, 0.0, 0.0, 0.0, 0.0, 0.002291709084994238, 0.0, 0.0, 0.0, 0.0], [0.0006092803753845975, 0.0, 0.0, 0.004372477702289994, 0.0, 0.0, 0.06710603871527036, 0.0, 0.0, 0.0  …  0.0041711096896454745, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.011287997598927976, 0.0020040637862256817, 0.0003326837475323491, 0.00034402684015257527, 0.06305103828047173, 0.03068200872784047, 0.0003505790613555631, 0.0020473225369636873, 0.0, 0.0191077565617325  …  0.005591228759882936, 0.0004356874830029748, 0.014434120586233577, 0.03514505772295519, 0.024907176866291014, 0.013342154173060372, 0.009686226103767459, 0.011051272187723254, 0.0021206651420422927, 0.01721782824162338], [0.0, 0.0, 0.0, 0.0, 8.57086390274792e-6, 0.0, 0.0, 0.0, 2.4536198623552867e-5, 0.0  …  0.008555738848801895, 0.3324338967920097, 0.22067672180252998, 0.2370889178393625, 0.0477595425645907, 0.012942508661614227, 0.004667927760053456, 0.021757222045203074, 0.0, 0.002000708524749294], [0.005090338238241512, 0.0005933402816643566, 1.793599921320476e-5, 0.007268146142708006, 0.05434404438533037, 0.02138421321578873, 0.023894091259534518, 0.028037089231640524, 0.005923381894006229, 0.011927802553688313  …  0.0014618202435669027, 0.0009447261124040238, 0.0001280209174610526, 0.0010477673386531637, 0.0, 0.0013030104043795392, 5.5260305268213854e-5, 0.0, 1.307076865739618e-5, 8.641230390167474e-6], [0.016810689305736877, 0.004087420487057966, 0.00036885674795364003, 0.05818437780960789, 0.04895082866561155, 0.04689140072807505, 0.010101572733480902, 0.016066325760592727, 0.00037371898454196314, 0.041008926225895866  …  0.0018123421762754539, 0.000401097116716159, 0.0003479865324437806, 0.0006664256271585853, 0.0028556289501379516, 0.001307065586721844, 6.418152296577174e-5, 0.0, 3.538212163497461e-5, 0.00020458795490837936], [0.37790282216028437 0.0 … 0.0 0.0; 0.0006712800413285777 0.8149348034258406 … 2.4029219530949635e-5 0.00019143106686926454; … ; 0.00037430822580994426 0.000357977071568566 … 0.3197327950788158 0.0011366219595362582; 0.0 5.36965607352849e-5 … 0.0 0.05594572929254256], [4.3800671000101816e-5 0.00010629745355671226 9.959785873214212e-5; 0.00010629745355671226 0.0004129178961230129 0.0003596689472264872; 9.959785873214212e-5 0.0003596689472264872 0.0004506370179043619], 219841.0, 405376.9, 0.5902859043576301, 89460.0, 0.0016459319014481277), BeforeIT.Data([1, 1], [72421.99999999999, 134635.75553779324], [72421.99999999999, NaN], [64900.92049553801, 132977.5478595263], [64900.92049553801, 64900.92049553801], [40512.94792630534, 0.0], [40512.94792630534, NaN], [14866.888022051655, 0.0], [14866.888022051655, NaN], [15944.236265986641, 0.0], [15944.236265986641, NaN], [15944.236265986641, 0.0], [15944.236265986641, NaN], [3173.2320350842083, 0.0], [3173.2320350842083, NaN], [34195.564496956766, 0.0], [34195.564496956766, NaN], [33097.63671130043, 0.0], [33097.63671130043, 0.0], [29576.147776884867, -2636.2694500373796], [34346.71094688275, 0.0], [28335.32931213966, 0.0], [978.0617717704337, 978.0617717704337], [0.0019383188997990075, 0.0019383188997990075], [2.3548476e6, 2.3548476e6], [0.0016459319014481277, 0.0016459319014481277], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895  …  998.4526557261888, 3385.10708496425, 3275.982679763442, 3256.198372613073, 1000.8740113003423, 544.8396657162824, 260.68690436538697, 434.1059751134286, 136.99722836422484, 504.90462950861706], [1318.4256343029062, 534.8893302842548, 10.188014506791214, 430.35757803851186, 4061.234729603041, 703.8444909093937, 1678.504480922274, 1405.0076647566113, 638.9482002041658, 953.1104205676534  …  1572.6135014677272, 4911.927751360869, 3791.2114940821, 4655.199689084511, 1438.874457086719, 773.910301490728, 411.0040642111517, 726.4017205986705, 240.03110727421836, 711.8364497983175]], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895  …  998.4526557261888, 3385.10708496425, 3275.982679763442, 3256.198372613073, 1000.8740113003423, 544.8396657162824, 260.68690436538697, 434.1059751134286, 136.99722836422484, 504.90462950861706], [518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895  …  998.4526557261888, 3385.10708496425, 3275.982679763442, 3256.198372613073, 1000.8740113003423, 544.8396657162824, 260.68690436538697, 434.1059751134286, 136.99722836422484, 504.90462950861706]]))

After that, we simulate both models

T = 20
model_vec_standard = Bit.ensemblerun!((deepcopy(std_model) for _ in 1:4), T);
model_vec_new = Bit.ensemblerun!((deepcopy(new_model) for _ in 1:4), T);

And plot the results

using Plots, StatsPlots
ps = Bit.plot_data_vectors([model_vec_standard, model_vec_new], quantities = [:euribor, :gdp_deflator])
plot(ps..., layout = (1, 2), size = (600, 300))
Example block output

Extension by Invocation

First, we create as before a new model type

Bit.@object struct NewModel2(Bit.Model) <: Bit.AbstractModel end

Now, let's say that one wants to track the number of employees in the economy, something not included by default when running a simulation. To do so, we create a new data type with

Bit.@object mutable struct MoreData(Bit.Data) <: Bit.AbstractData
    N_employed::Vector{Int} = Int[]
end

We then need to specialize the function Bit.collect_data!, and, at the same time, invoke the default tracking because we don't want to lose the information on the other variables

function Bit.collect_data!(m::NewModel2)
    @invoke Bit.collect_data!(m::Bit.AbstractModel)
    push!(m.data.N_employed, sum(m.firms.N_i))
    return m
end

We then initialize the model as usual

firms = Bit.Firms(p, ic)
w_act, w_inact = Bit.Workers(p, ic)
cb = Bit.CentralBank(p, ic)
bank = Bit.Bank(p, ic)
government = Bit.Government(p, ic)
rotw = Bit.RestOfTheWorld(p, ic)
agg = Bit.Aggregates(p, ic)
properties = Bit.Properties(p, ic)
mdata = MoreData()
new_model = NewModel2((w_act, w_inact, firms, bank, cb, government, rotw, agg, properties, mdata))
Main.NewModel2{BeforeIT.Workers, BeforeIT.Workers, BeforeIT.Firms, BeforeIT.Bank, BeforeIT.CentralBank, BeforeIT.Government, BeforeIT.RestOfTheWorld, BeforeIT.Aggregates, BeforeIT.Properties, Main.MoreData}(BeforeIT.Workers(Base.RefValue{Bool}(false), Base.RefValue{Int64}(4118), Dict{Int64, Int64}(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118], [0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249, 0.7661282859097249  …  4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569, 4.655745607447569], [3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487, 3.781806633594487  …  22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958, 22.981960001210958], [6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249, 6.973481059156249  …  42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032, 42.37769888790032], [0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983  …  11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522, 11.337587012313522], [1, 1, 2, 3, 3, 3, 3, 3, 4, 4  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), BeforeIT.Workers(Base.RefValue{Bool}(false), Base.RefValue{Int64}(4130), Dict{Int64, Int64}(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130], [2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714  …  2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714, 2.8287542404944714], [13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984  …  13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984, 13.963459838592984], [25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977  …  25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977, 25.74799087814977], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1  …  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), BeforeIT.Firms(Base.RefValue{Bool}(false), Base.RefValue{Int64}(624), Dict{Int64, Int64}(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  615, 616, 617, 618, 619, 620, 621, 622, 623, 624], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1  …  62, 62, 62, 62, 62, 62, 62, 62, 62, 62], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951], [1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485, 1.6631751855300485  …  3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877, 3.4759574544453877], [0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754, 0.042702129272078754  …  0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946, 0.17805766706016946], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983, 0.2697101055708983  …  2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687, 2.6020133813757687], [0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721, 0.011078553057541721  …  0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782, 0.012425621091468782], [0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832, 0.009528627732528832  …  0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318, 0.010357147774366318], [-0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635, -0.26105054841223635  …  0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037, 0.013413693877270037], [2, 1, 5, 2, 2, 2, 2, 1, 1, 1  …  1, 1, 1, 1, 3, 1, 1, 1, 1, 1], [21.644053318613242, 10.822026659306621, 54.11013329653311, 21.644053318613242, 21.644053318613242, 21.644053318613242, 21.644053318613242, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 35.96431016489685, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [21.644053318613242, 10.822026659306621, 54.11013329653311, 21.644053318613242, 21.644053318613242, 21.644053318613242, 21.644053318613242, 10.822026659306621, 10.822026659306621, 10.822026659306621  …  11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 35.96431016489685, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [596.3073170731707, 298.15365853658534, 1490.7682926829268, 596.3073170731707, 596.3073170731707, 596.3073170731707, 596.3073170731707, 298.15365853658534, 298.15365853658534, 298.15365853658534  …  79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 237.625, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334], [15.3102285081471, 7.65511425407355, 38.27557127036775, 15.3102285081471, 15.3102285081471, 15.3102285081471, 15.3102285081471, 7.65511425407355, 7.65511425407355, 7.65511425407355  …  4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 12.172460017041193, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064], [188.16148249216, 94.08074124608, 470.40370623039996, 188.16148249216, 188.16148249216, 188.16148249216, 188.16148249216, 94.08074124608, 94.08074124608, 94.08074124608  …  24.993752380711378, 24.993752380711378, 24.993752380711378, 24.993752380711378, 74.98125714213411, 24.993752380711378, 24.993752380711378, 24.993752380711378, 24.993752380711378, 24.993752380711378], [0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726, 0.36061475737617726  …  0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956, 0.35565736393550956], [24.768584106134007, 12.384292053067004, 61.921460265335014, 24.768584106134007, 24.768584106134007, 24.768584106134007, 24.768584106134007, 12.384292053067004, 12.384292053067004, 12.384292053067004  …  13.530111496595195, 13.530111496595195, 13.530111496595195, 13.530111496595195, 40.59033448978558, 13.530111496595195, 13.530111496595195, 13.530111496595195, 13.530111496595195, 13.530111496595195], [2.509690934952873, 1.2548454674764364, 6.274227337382183, 2.509690934952873, 2.509690934952873, 2.509690934952873, 2.509690934952873, 1.2548454674764364, 1.2548454674764364, 1.2548454674764364  …  3.5771064837982873, 3.5771064837982873, 3.5771064837982873, 3.5771064837982873, 10.731319451394864, 3.5771064837982873, 3.5771064837982873, 3.5771064837982873, 3.5771064837982873, 3.5771064837982873], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0  …  0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [2.0220856873365385, 1.3061857958470844, 4.169785361804903, 2.0220856873365385, 2.0220856873365385, 2.0220856873365385, 2.0220856873365385, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844  …  2.631055234104207, 2.631055234104207, 2.631055234104207, 2.631055234104207, 6.712593893597363, 2.631055234104207, 2.631055234104207, 2.631055234104207, 2.631055234104207, 2.631055234104207], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [18.405502707537227, 11.889212387273577, 37.954373668328195, 18.405502707537227, 18.405502707537227, 18.405502707537227, 18.405502707537227, 11.889212387273577, 11.889212387273577, 11.889212387273577  …  23.948487711601803, 23.948487711601803, 23.948487711601803, 23.948487711601803, 61.09961900078557, 23.948487711601803, 23.948487711601803, 23.948487711601803, 23.948487711601803, 23.948487711601803], [9.981535999529552, 6.447669663541781, 20.58313500749287, 9.981535999529552, 9.981535999529552, 9.981535999529552, 9.981535999529552, 6.447669663541781, 6.447669663541781, 6.447669663541781  …  12.98756660038165, 12.98756660038165, 12.98756660038165, 12.98756660038165, 33.13509314603694, 12.98756660038165, 12.98756660038165, 12.98756660038165, 12.98756660038165, 12.98756660038165]), BeforeIT.Bank(89460.0, 6476.29252774436, 0.0, 126431.00000000003, 0.028359903595743693, 3695.3696336675225, 0.0, 0.0, 0.0, 0.0, 33636.12938055408, 18241.296726948152), BeforeIT.CentralBank(0.0016459319014481277, 0.0089810924595537, 0.9259668580654086, -0.003424572940686137, 0.0049629315732038215, 0.30996974466133875, 1.328593153520194, 106179.90000000002), BeforeIT.Government(0.9905949533296431, 0.09373211872949586, 0.011235005057648862, 0.0, 14732.121510837034, 232610.9, 2.238468336136841, 0.5902859043576301, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0, 0.0), BeforeIT.RestOfTheWorld(0.962809216044625, 0.39260026877953946, 0.020320381298662014, 0.9662360466537488, 0.35492769963078624, 0.02122821278168188, 2.3548476e6, 0.0, 0.0019383188997990075, 0.38456173629534834, 0.0026219533879005877, 0.0025327891562467505, 0.9635784504324201, 0.5360029623199525, 0.006618207536795881, 0.0, 33097.63671130043, 34095.03119997918, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0.0), BeforeIT.Aggregates([104531.39273728609, 105062.38754395355, 105399.12953350678, 106689.88106040593, 107938.33111423723, 108890.48532381697, 110110.17779727321, 110374.00540561741, 110808.89423399912, 111932.48072916963  …  139382.61162744602, 141288.21877604182, 140554.06557898276, 139768.5198028018, 137144.71527593565, 135054.13194905635, 133851.32295827195, 134293.63309771818, 135709.0626505015, 134635.75553779321], [-0.007497362866886709, -0.007895434153021436, -0.0019938777296781562, -0.0035311300388783107, 0.001212170001002849, -0.001672412335241874, 0.001839696090252002, 0.004290005139261838, 0.00600429551344886, 0.0036060572293247772  …  0.010368416047796258, 0.005161476804794514, -0.0025695603517498014, 0.0006033009671786438, 0.013376536173073151, 0.005811645790062013, -0.0003164402217366337, 0.004034477127754229, 0.005303186518592234, 0.0010079589742698286], 1.0, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1), BeforeIT.Properties(62, 54, 4743, 4130, 156, 312, [48, 2, 1, 1, 5, 2, 4, 1, 1, 1  …  14, 10, 13, 41, 20, 16, 7, 7, 2, 19], 624, 8873, 0.21340742230566648, 0.07701197259426128, 0.1528683933530887, 0.21215146534992413, 0.17114894621657745, 0.0029486201783457183, 0.08761417854834112, 0.009147800682711324, 0.3585824478060919, 0.9096681249468772, 0.07125099957246343, 0.026713971694295565, 0.7858074440019603, 0.05, 0.03, 0.6, 0.5, [0.0033476048872100555, 0.0, 0.0, 0.0008050086095806136, 0.0, 0.003306696048303853, 0.0030629933432974495, 0.0, 0.0, 0.0  …  0.0017883064872300512, 0.0, 0.0, 0.0, 0.0, 0.002291709084994238, 0.0, 0.0, 0.0, 0.0], [0.0006092803753845975, 0.0, 0.0, 0.004372477702289994, 0.0, 0.0, 0.06710603871527036, 0.0, 0.0, 0.0  …  0.0041711096896454745, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.011287997598927976, 0.0020040637862256817, 0.0003326837475323491, 0.00034402684015257527, 0.06305103828047173, 0.03068200872784047, 0.0003505790613555631, 0.0020473225369636873, 0.0, 0.0191077565617325  …  0.005591228759882936, 0.0004356874830029748, 0.014434120586233577, 0.03514505772295519, 0.024907176866291014, 0.013342154173060372, 0.009686226103767459, 0.011051272187723254, 0.0021206651420422927, 0.01721782824162338], [0.0, 0.0, 0.0, 0.0, 8.57086390274792e-6, 0.0, 0.0, 0.0, 2.4536198623552867e-5, 0.0  …  0.008555738848801895, 0.3324338967920097, 0.22067672180252998, 0.2370889178393625, 0.0477595425645907, 0.012942508661614227, 0.004667927760053456, 0.021757222045203074, 0.0, 0.002000708524749294], [0.005090338238241512, 0.0005933402816643566, 1.793599921320476e-5, 0.007268146142708006, 0.05434404438533037, 0.02138421321578873, 0.023894091259534518, 0.028037089231640524, 0.005923381894006229, 0.011927802553688313  …  0.0014618202435669027, 0.0009447261124040238, 0.0001280209174610526, 0.0010477673386531637, 0.0, 0.0013030104043795392, 5.5260305268213854e-5, 0.0, 1.307076865739618e-5, 8.641230390167474e-6], [0.016810689305736877, 0.004087420487057966, 0.00036885674795364003, 0.05818437780960789, 0.04895082866561155, 0.04689140072807505, 0.010101572733480902, 0.016066325760592727, 0.00037371898454196314, 0.041008926225895866  …  0.0018123421762754539, 0.000401097116716159, 0.0003479865324437806, 0.0006664256271585853, 0.0028556289501379516, 0.001307065586721844, 6.418152296577174e-5, 0.0, 3.538212163497461e-5, 0.00020458795490837936], [0.37790282216028437 0.0 … 0.0 0.0; 0.0006712800413285777 0.8149348034258406 … 2.4029219530949635e-5 0.00019143106686926454; … ; 0.00037430822580994426 0.000357977071568566 … 0.3197327950788158 0.0011366219595362582; 0.0 5.36965607352849e-5 … 0.0 0.05594572929254256], [4.3800671000101816e-5 0.00010629745355671226 9.959785873214212e-5; 0.00010629745355671226 0.0004129178961230129 0.0003596689472264872; 9.959785873214212e-5 0.0003596689472264872 0.0004506370179043619], 219841.0, 405376.9, 0.5902859043576301, 89460.0, 0.0016459319014481277), Main.MoreData([1], [72422.0], [72422.0], [64900.920495538005], [64900.920495538005], [40512.94792630534], [40512.94792630534], [14866.888022051655], [14866.888022051655], [15944.236265986638], [15944.236265986638], [15944.236265986638], [15944.236265986638], [3173.2320350842083], [3173.2320350842083], [34195.564496956766], [34195.564496956766], [33097.63671130043], [33097.63671130043], [29576.14777688488], [34346.71094688275], [28335.32931213966], [978.0617717704337], [0.0019383188997990075], [2.3548476e6], [0.0016459319014481277], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380713, 403.48993929545065, 384.7628088630399, 236.96603753924677, 46.741075546466895  …  998.452655726189, 3385.10708496425, 3275.9826797634414, 3256.1983726130716, 1000.8740113003424, 544.8396657162823, 260.68690436538697, 434.1059751134285, 136.99722836422484, 504.90462950861706]], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380713, 403.48993929545065, 384.7628088630399, 236.96603753924677, 46.741075546466895  …  998.452655726189, 3385.10708496425, 3275.9826797634414, 3256.1983726130716, 1000.8740113003424, 544.8396657162823, 260.68690436538697, 434.1059751134285, 136.99722836422484, 504.90462950861706]], [3866]))

and run the simulation

Bit.run!(new_model, T);

Finally we can plot the new data

plot(new_model.data.N_employed, label = "Employed Workers")
Example block output