Extending BeforeIT using macros and multiple dispatch
Extension by Specialization
import BeforeIT as Bit
using PlotsWhen 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 endIn 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
endand then change the default central bank behaviour for the new type
Bit.central_bank_rate(model::NewModel) = model.cb.fixed_rateNow, 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, 2, 3, 4, 5, 5, 5, 5, 5, 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], [1, 1, 1, 1, 38, 1, 1, 1, 1, 1 … 1, 2, 1, 1, 4, 1, 10, 1, 3, 3], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 411.2370130536516, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621 … 11.988103388298951, 23.976206776597902, 11.988103388298951, 11.988103388298951, 47.952413553195804, 11.988103388298951, 119.88103388298951, 11.988103388298951, 35.96431016489685, 35.96431016489685], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 10.822026659306621, 10.822026659306621, 411.2370130536516, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621 … 11.988103388298951, 23.976206776597902, 11.988103388298951, 11.988103388298951, 47.952413553195804, 11.988103388298951, 119.88103388298951, 11.988103388298951, 35.96431016489685, 35.96431016489685], [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, 298.15365853658534, 298.15365853658534, 11329.839024390243, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534 … 79.20833333333334, 158.41666666666669, 79.20833333333334, 79.20833333333334, 316.83333333333337, 79.20833333333334, 792.0833333333334, 79.20833333333334, 237.625, 237.625], [7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 290.89434165479486, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355 … 4.057486672347064, 8.114973344694128, 4.057486672347064, 4.057486672347064, 16.229946689388257, 4.057486672347064, 40.57486672347065, 4.057486672347064, 12.172460017041193, 12.172460017041193], [94.08074124608001, 94.08074124608001, 94.08074124608001, 94.08074124608001, 3575.06816735104, 94.08074124608001, 94.08074124608001, 94.08074124608001, 94.08074124608001, 94.08074124608001 … 24.99375238071138, 49.98750476142276, 24.99375238071138, 24.99375238071138, 99.97500952284553, 24.99375238071138, 249.93752380711376, 24.99375238071138, 74.98125714213413, 74.98125714213413], [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.384292053067009, 12.384292053067009, 12.384292053067009, 12.384292053067009, 470.60309801654637, 12.384292053067009, 12.384292053067009, 12.384292053067009, 12.384292053067009, 12.384292053067009 … 13.5301114965952, 27.0602229931904, 13.5301114965952, 13.5301114965952, 54.1204459863808, 13.5301114965952, 135.30111496595202, 13.5301114965952, 40.5903344897856, 40.5903344897856], [1.254845467476436, 1.254845467476436, 1.254845467476436, 1.254845467476436, 47.6841277641046, 1.254845467476436, 1.254845467476436, 1.254845467476436, 1.254845467476436, 1.254845467476436 … 3.5771064837982873, 7.154212967596575, 3.5771064837982873, 3.5771064837982873, 14.30842593519315, 3.5771064837982873, 35.77106483798288, 3.5771064837982873, 10.731319451394864, 10.731319451394864], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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.3061857958470842, 1.3061857958470842, 1.3061857958470842, 1.3061857958470842, 27.794481780956904, 1.3061857958470842, 1.3061857958470842, 1.3061857958470842, 1.3061857958470842, 1.3061857958470842 … 2.631055234104207, 4.671824563850785, 2.631055234104207, 2.631055234104207, 8.75336322334394, 2.631055234104207, 20.9979792018234, 2.631055234104207, 6.712593893597363, 6.712593893597363], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0002669575553746344, 0.0002669575553746344, 0.0002669575553746344, 0.0002669575553746344, 0.005680621342492172, 0.0002669575553746344, 0.0002669575553746344, 0.0002669575553746344, 0.0002669575553746344, 0.0002669575553746344 … 0.0005377336636068607, 0.0009548250093287502, 0.0005377336636068607, 0.0005377336636068607, 0.0017890077007725292, 0.0005377336636068607, 0.0042915557751038655, 0.0005377336636068607, 0.0013719163550506399, 0.0013719163550506399], [0.00014477444553726422, 0.00014477444553726422, 0.00014477444553726422, 0.00014477444553726422, 0.0030806725211891, 0.00014477444553726422, 0.00014477444553726422, 0.00014477444553726422, 0.00014477444553726422, 0.00014477444553726422 … 0.00029161974039713625, 0.000517813631896247, 0.00029161974039713625, 0.00029161974039713625, 0.0009702014148944687, 0.00029161974039713625, 0.0023273647638891335, 0.00029161974039713625, 0.0007440075233953581, 0.0007440075233953581]), BeforeIT.Bank(89460.0, 6476.292527744359, 0.0, 33080.70416753882, 0.028359903595743693, 3695.369633667522, 0.0, 0.0, 0.0, 0.0, 33636.12938055408, 18241.296726948152), 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.99999999997, 134635.7555377932], [72421.99999999997, NaN], [64900.92049553803, 132977.54785952624], [64900.92049553803, 64900.92049553803], [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.147776884878, -2636.269450037379], [34346.71094688275, 0.0], [28335.32931213966, 0.0], [978.0617717704338, 978.0617717704338], [0.0019383188997990075, 0.0019383188997990075], [2.3548476e6, 2.3548476e6], [0.0016459319014481277, 0.0016459319014481277], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.1560623238072, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261888, 3385.10708496425, 3275.982679763442, 3256.1983726130725, 1000.8740113003424, 544.8396657162824, 260.68690436538697, 434.10597511342854, 136.99722836422484, 504.90462950861706], [1318.4256343029067, 534.8893302842547, 10.188014506791214, 430.35757803851186, 4061.2347296030416, 703.8444909093937, 1678.504480922274, 1405.0076647566113, 638.9482002041658, 953.1104205676534 … 1572.613501467727, 4911.9277513608695, 3791.2114940821, 4655.199689084512, 1438.8744570867193, 773.910301490728, 411.0040642111516, 726.4017205986706, 240.03110727421833, 711.8364497983175]], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.1560623238072, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261888, 3385.10708496425, 3275.982679763442, 3256.1983726130725, 1000.8740113003424, 544.8396657162824, 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.4526557261888, 3385.10708496425, 3275.982679763442, 3256.1983726130725, 1000.8740113003424, 544.8396657162824, 260.68690436538697, 434.10597511342854, 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))Extension by Invocation
First, we create as before a new model type
Bit.@object struct NewModel2(Bit.Model) <: Bit.AbstractModel endNow, 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[]
endWe 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
endWe 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.7818066335944875, 3.7818066335944875, 3.7818066335944875, 3.7818066335944875, 3.7818066335944875, 3.7818066335944875, 3.7818066335944875, 3.7818066335944875, 3.7818066335944875, 3.7818066335944875 … 22.98196000121096, 22.98196000121096, 22.98196000121096, 22.98196000121096, 22.98196000121096, 22.98196000121096, 22.98196000121096, 22.98196000121096, 22.98196000121096, 22.98196000121096], [6.973481059156251, 6.973481059156251, 6.973481059156251, 6.973481059156251, 6.973481059156251, 6.973481059156251, 6.973481059156251, 6.973481059156251, 6.973481059156251, 6.973481059156251 … 42.37769888790033, 42.37769888790033, 42.37769888790033, 42.37769888790033, 42.37769888790033, 42.37769888790033, 42.37769888790033, 42.37769888790033, 42.37769888790033, 42.37769888790033], [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, 3, 3, 3, 4, 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(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.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986 … 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986, 13.963459838592986], [25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775 … 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775, 25.747990878149775], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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], [1, 1, 5, 1, 1, 1, 2, 1, 1, 3 … 4, 1, 1, 9, 1, 2, 2, 2, 2, 16], [10.822026659306621, 10.822026659306621, 54.11013329653311, 10.822026659306621, 10.822026659306621, 10.822026659306621, 21.644053318613242, 10.822026659306621, 10.822026659306621, 32.46607997791986 … 47.952413553195804, 11.988103388298951, 11.988103388298951, 107.89293049469056, 11.988103388298951, 23.976206776597902, 23.976206776597902, 23.976206776597902, 23.976206776597902, 191.80965421278322], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 54.11013329653311, 10.822026659306621, 10.822026659306621, 10.822026659306621, 21.644053318613242, 10.822026659306621, 10.822026659306621, 32.46607997791986 … 47.952413553195804, 11.988103388298951, 11.988103388298951, 107.89293049469056, 11.988103388298951, 23.976206776597902, 23.976206776597902, 23.976206776597902, 23.976206776597902, 191.80965421278322], [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, 1490.7682926829268, 298.15365853658534, 298.15365853658534, 298.15365853658534, 596.3073170731707, 298.15365853658534, 298.15365853658534, 894.460975609756 … 316.83333333333337, 79.20833333333334, 79.20833333333334, 712.8750000000001, 79.20833333333334, 158.41666666666669, 158.41666666666669, 158.41666666666669, 158.41666666666669, 1267.3333333333335], [7.65511425407355, 7.65511425407355, 38.27557127036775, 7.65511425407355, 7.65511425407355, 7.65511425407355, 15.3102285081471, 7.65511425407355, 7.65511425407355, 22.965342762220647 … 16.229946689388257, 4.057486672347064, 4.057486672347064, 36.51738005112358, 4.057486672347064, 8.114973344694128, 8.114973344694128, 8.114973344694128, 8.114973344694128, 64.91978675755303], [94.08074124608001, 94.08074124608001, 470.4037062304, 94.08074124608001, 94.08074124608001, 94.08074124608001, 188.16148249216002, 94.08074124608001, 94.08074124608001, 282.24222373824 … 99.97500952284553, 24.99375238071138, 24.99375238071138, 224.94377142640244, 24.99375238071138, 49.98750476142276, 49.98750476142276, 49.98750476142276, 49.98750476142276, 399.9000380913821], [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.384292053067009, 12.384292053067009, 61.92146026533504, 12.384292053067009, 12.384292053067009, 12.384292053067009, 24.768584106134018, 12.384292053067009, 12.384292053067009, 37.15287615920102 … 54.1204459863808, 13.5301114965952, 13.5301114965952, 121.7710034693568, 13.5301114965952, 27.0602229931904, 27.0602229931904, 27.0602229931904, 27.0602229931904, 216.4817839455232], [1.254845467476436, 1.254845467476436, 6.2742273373821815, 1.254845467476436, 1.254845467476436, 1.254845467476436, 2.509690934952872, 1.254845467476436, 1.254845467476436, 3.7645364024293086 … 14.30842593519315, 3.5771064837982873, 3.5771064837982873, 32.19395835418458, 3.5771064837982873, 7.154212967596575, 7.154212967596575, 7.154212967596575, 7.154212967596575, 57.2337037407726], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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.3061857958470842, 1.3061857958470842, 4.169785361804902, 1.3061857958470842, 1.3061857958470842, 1.3061857958470842, 2.0220856873365385, 1.3061857958470842, 1.3061857958470842, 2.7379855788259926 … 8.75336322334394, 2.631055234104207, 2.631055234104207, 18.95720987207682, 2.631055234104207, 4.671824563850785, 4.671824563850785, 4.671824563850785, 4.671824563850785, 33.242595180302864], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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.889212387273577, 11.889212387273577, 37.95437366832819, 11.889212387273577, 11.889212387273577, 11.889212387273577, 18.40550270753723, 11.889212387273577, 11.889212387273577, 24.921793027800884 … 79.67518464537746, 23.948487711601807, 23.948487711601807, 172.5530128683368, 23.948487711601807, 42.52405335619369, 42.52405335619369, 42.52405335619369, 42.52405335619369, 302.58197238048], [6.447669663541781, 6.447669663541781, 20.583135007492874, 6.447669663541781, 6.447669663541781, 6.447669663541781, 9.981535999529553, 6.447669663541781, 6.447669663541781, 13.515402335517324 … 43.20885641886458, 12.987566600381651, 12.987566600381651, 93.57767278300275, 12.987566600381651, 23.061329873209292, 23.061329873209292, 23.061329873209292, 23.061329873209292, 164.09401569279626]), BeforeIT.Bank(89460.0, 6476.29252774436, 0.0, 126431.00000000003, 0.028359903595743693, 3695.3696336675225, 0.0, 0.0, 0.0, 0.0, 33636.129380554084, 18241.296726948156), 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.92049553802], [64900.92049553802], [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.147776884878], [34346.71094688275], [28335.329312139664], [978.0617717704337], [0.0019383188997990075], [2.3548476e6], [0.0016459319014481277], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.452655726189, 3385.1070849642506, 3275.9826797634414, 3256.1983726130725, 1000.8740113003424, 544.8396657162824, 260.686904365387, 434.1059751134285, 136.99722836422484, 504.9046295086172]], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.452655726189, 3385.1070849642506, 3275.9826797634414, 3256.1983726130725, 1000.8740113003424, 544.8396657162824, 260.686904365387, 434.1059751134285, 136.99722836422484, 504.9046295086172]], [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")