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)
standard_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([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, 1, 2, 2, 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([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([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], [5, 2, 1, 1, 1, 1, 1, 1, 1, 2 … 1, 1, 1, 1, 5, 1, 1, 1, 1, 1], [54.11013329653311, 21.644053318613242, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 21.644053318613242 … 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 59.94051694149476, 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], [54.11013329653311, 21.644053318613242, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 21.644053318613242 … 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 59.94051694149476, 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], [1490.7682926829268, 596.3073170731707, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 596.3073170731707 … 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 396.0416666666667, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334], [38.27557127036775, 15.3102285081471, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 15.3102285081471 … 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 20.287433361735324, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064], [470.4037062303998, 188.16148249215993, 94.08074124607997, 94.08074124607997, 94.08074124607997, 94.08074124607997, 94.08074124607997, 94.08074124607997, 94.08074124607997, 188.16148249215993 … 24.99375238071137, 24.99375238071137, 24.99375238071137, 24.99375238071137, 124.96876190355682, 24.99375238071137, 24.99375238071137, 24.99375238071137, 24.99375238071137, 24.99375238071137], [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], [61.921460265335, 24.768584106134, 12.384292053067, 12.384292053067, 12.384292053067, 12.384292053067, 12.384292053067, 12.384292053067, 12.384292053067, 24.768584106134 … 13.530111496595191, 13.530111496595191, 13.530111496595191, 13.530111496595191, 67.65055748297596, 13.530111496595191, 13.530111496595191, 13.530111496595191, 13.530111496595191, 13.530111496595191], [6.274227337382189, 2.5096909349528747, 1.2548454674764373, 1.2548454674764373, 1.2548454674764373, 1.2548454674764373, 1.2548454674764373, 1.2548454674764373, 1.2548454674764373, 2.5096909349528747 … 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 17.88553241899144, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [4.169785361804905, 2.02208568733654, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 1.3061857958470848, 2.02208568733654 … 2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208, 10.794132553090517, 2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0008522185053332878, 0.0004132727928642978, 0.00026695755537463453, 0.00026695755537463453, 0.00026695755537463453, 0.00026695755537463453, 0.00026695755537463453, 0.00026695755537463453, 0.00026695755537463453, 0.0004132727928642978 … 0.000537733663606861, 0.000537733663606861, 0.000537733663606861, 0.000537733663606861, 0.0022060990464944186, 0.000537733663606861, 0.000537733663606861, 0.000537733663606861, 0.000537733663606861, 0.000537733663606861], [0.0004621688320942197, 0.00022412304217650316, 0.0001447744455372643, 0.0001447744455372643, 0.0001447744455372643, 0.0001447744455372643, 0.0001447744455372643, 0.0001447744455372643, 0.0001447744455372643, 0.00022412304217650316 … 0.0002916197403971363, 0.0002916197403971363, 0.0002916197403971363, 0.0002916197403971363, 0.0011963953063935796, 0.0002916197403971363, 0.0002916197403971363, 0.0002916197403971363, 0.0002916197403971363, 0.0002916197403971363]), BeforeIT.Bank(89460.0, 6476.292527744357, 0.0, 33080.70416753885, 0.028359903595743693, 3695.3696336675207, 0.0, 0.0, 0.0, 0.0, 33636.12938055406, 18241.296726948145), 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], [72422.0, 134635.7555377931], [72422.0, NaN], [64900.92049553801, 132977.54785952615], [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.147776884885, -2636.2694500373777], [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.48993929545054, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261889, 3385.1070849642497, 3275.982679763442, 3256.198372613072, 1000.8740113003423, 544.8396657162824, 260.686904365387, 434.1059751134285, 136.99722836422484, 504.90462950861706], [1318.4256343029065, 534.8893302842547, 10.188014506791214, 430.35757803851186, 4061.2347296030416, 703.8444909093937, 1678.504480922274, 1405.0076647566113, 638.9482002041658, 953.1104205676534 … 1572.6135014677275, 4911.927751360869, 3791.2114940821, 4655.199689084513, 1438.8744570867193, 773.9103014907279, 411.0040642111516, 726.4017205986705, 240.03110727421836, 711.8364497983175]], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.48993929545054, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261889, 3385.1070849642497, 3275.982679763442, 3256.198372613072, 1000.8740113003423, 544.8396657162824, 260.686904365387, 434.1059751134285, 136.99722836422484, 504.90462950861706], [518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.48993929545054, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261889, 3385.1070849642497, 3275.982679763442, 3256.198372613072, 1000.8740113003423, 544.8396657162824, 260.686904365387, 434.1059751134285, 136.99722836422484, 504.90462950861706]]))
After that, we simulate both models
T = 20
model_vec_standard = Bit.ensemblerun(standard_model, T, 4);
model_vec_new = Bit.ensemblerun(new_model, T, 4);
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))
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.update_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.update_data!(m::NewModel2)
@invoke Bit.update_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([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, 2, 3, 3, 4, 4, 5, 5, 5, 6 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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([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([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], [1, 1, 2, 2, 3, 2, 1, 5, 1, 4 … 1, 1, 1, 2, 1, 1, 1, 1, 1, 1], [10.822026659306621, 10.822026659306621, 21.644053318613242, 21.644053318613242, 32.46607997791986, 21.644053318613242, 10.822026659306621, 54.11013329653311, 10.822026659306621, 43.288106637226484 … 11.988103388298951, 11.988103388298951, 11.988103388298951, 23.976206776597902, 11.988103388298951, 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], [10.822026659306621, 10.822026659306621, 21.644053318613242, 21.644053318613242, 32.46607997791986, 21.644053318613242, 10.822026659306621, 54.11013329653311, 10.822026659306621, 43.288106637226484 … 11.988103388298951, 11.988103388298951, 11.988103388298951, 23.976206776597902, 11.988103388298951, 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], [298.15365853658534, 298.15365853658534, 596.3073170731707, 596.3073170731707, 894.460975609756, 596.3073170731707, 298.15365853658534, 1490.7682926829268, 298.15365853658534, 1192.6146341463414 … 79.20833333333334, 79.20833333333334, 79.20833333333334, 158.41666666666669, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334], [7.65511425407355, 7.65511425407355, 15.3102285081471, 15.3102285081471, 22.965342762220647, 15.3102285081471, 7.65511425407355, 38.27557127036775, 7.65511425407355, 30.6204570162942 … 4.057486672347064, 4.057486672347064, 4.057486672347064, 8.114973344694128, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064], [94.08074124607998, 94.08074124607998, 188.16148249215996, 188.16148249215996, 282.24222373823994, 188.16148249215996, 94.08074124607998, 470.4037062303999, 94.08074124607998, 376.3229649843199 … 24.993752380711374, 24.993752380711374, 24.993752380711374, 49.98750476142275, 24.993752380711374, 24.993752380711374, 24.993752380711374, 24.993752380711374, 24.993752380711374, 24.993752380711374], [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], [12.384292053067, 12.384292053067, 24.768584106134, 24.768584106134, 37.15287615920099, 24.768584106134, 12.384292053067, 61.921460265335, 12.384292053067, 49.537168212268 … 13.530111496595191, 13.530111496595191, 13.530111496595191, 27.060222993190383, 13.530111496595191, 13.530111496595191, 13.530111496595191, 13.530111496595191, 13.530111496595191, 13.530111496595191], [1.2548454674764369, 1.2548454674764369, 2.5096909349528738, 2.5096909349528738, 3.7645364024293104, 2.5096909349528738, 1.2548454674764369, 6.274227337382185, 1.2548454674764369, 5.0193818699057475 … 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 7.1542129675965755, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878, 3.5771064837982878], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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.3061857958470848, 1.3061857958470848, 2.0220856873365394, 2.0220856873365394, 2.7379855788259935, 2.0220856873365394, 1.3061857958470848, 4.1697853618049034, 1.3061857958470848, 3.4538854703154485 … 2.631055234104208, 2.631055234104208, 2.631055234104208, 4.671824563850786, 2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208, 2.631055234104208], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [11.88921238727358, 11.88921238727358, 18.405502707537234, 18.405502707537234, 24.921793027800884, 18.405502707537234, 11.88921238727358, 37.954373668328195, 11.88921238727358, 31.43808334806454 … 23.94848771160181, 23.94848771160181, 23.94848771160181, 42.5240533561937, 23.94848771160181, 23.94848771160181, 23.94848771160181, 23.94848771160181, 23.94848771160181, 23.94848771160181], [6.447669663541784, 6.447669663541784, 9.981535999529557, 9.981535999529557, 13.515402335517328, 9.981535999529557, 6.447669663541784, 20.583135007492878, 6.447669663541784, 17.0492686715051 … 12.987566600381651, 12.987566600381651, 12.987566600381651, 23.061329873209296, 12.987566600381651, 12.987566600381651, 12.987566600381651, 12.987566600381651, 12.987566600381651, 12.987566600381651]), BeforeIT.Bank(89460.0, 6476.29252774436, 0.0, 126431.0, 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], [72421.99999999999], [72421.99999999999], [64900.92049553801], [64900.92049553801], [40512.94792630534], [40512.94792630534], [14866.888022051655], [14866.888022051655], [15944.236265986641], [15944.236265986641], [15944.236265986641], [15944.236265986641], [3173.2320350842083], [3173.2320350842083], [34195.564496956766], [34195.564496956766], [33097.63671130043], [33097.63671130043], [29576.14777688488], [34346.71094688274], [28335.329312139656], [978.0617717704339], [0.0019383188997990075], [2.3548476e6], [0.0016459319014481277], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.1560623238072, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.452655726189, 3385.1070849642497, 3275.982679763442, 3256.198372613071, 1000.8740113003425, 544.8396657162825, 260.68690436538697, 434.10597511342854, 136.99722836422484, 504.90462950861706]], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.1560623238072, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.452655726189, 3385.1070849642497, 3275.982679763442, 3256.198372613071, 1000.8740113003425, 544.8396657162825, 260.68690436538697, 434.10597511342854, 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")