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, 30, 1, 1, 37, 1, 1 … 1, 1, 1, 1, 14, 2, 1, 1, 3, 4], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 324.6607997791986, 10.822026659306621, 10.822026659306621, 400.41498639434496, 10.822026659306621, 10.822026659306621 … 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 167.8334474361853, 23.976206776597902, 11.988103388298951, 11.988103388298951, 35.96431016489685, 47.952413553195804], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 324.6607997791986, 10.822026659306621, 10.822026659306621, 400.41498639434496, 10.822026659306621, 10.822026659306621 … 11.988103388298951, 11.988103388298951, 11.988103388298951, 11.988103388298951, 167.8334474361853, 23.976206776597902, 11.988103388298951, 11.988103388298951, 35.96431016489685, 47.952413553195804], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 … 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 8944.609756097561, 298.15365853658534, 298.15365853658534, 11031.685365853658, 298.15365853658534, 298.15365853658534 … 79.20833333333334, 79.20833333333334, 79.20833333333334, 79.20833333333334, 1108.9166666666667, 158.41666666666669, 79.20833333333334, 79.20833333333334, 237.625, 316.83333333333337], [7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 229.65342762220646, 7.65511425407355, 7.65511425407355, 283.23922740072135, 7.65511425407355, 7.65511425407355 … 4.057486672347064, 4.057486672347064, 4.057486672347064, 4.057486672347064, 56.804813412858906, 8.114973344694128, 4.057486672347064, 4.057486672347064, 12.172460017041193, 16.229946689388257], [94.08074124608, 94.08074124608, 94.08074124608, 94.08074124608, 2822.4222373824, 94.08074124608, 94.08074124608, 3480.9874261049595, 94.08074124608, 94.08074124608 … 24.993752380711378, 24.993752380711378, 24.993752380711378, 24.993752380711378, 349.9125333299593, 49.987504761422755, 24.993752380711378, 24.993752380711378, 74.98125714213411, 99.97500952284551], [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, 371.52876159201026, 12.384292053067009, 12.384292053067009, 458.2188059634793, 12.384292053067009, 12.384292053067009 … 13.5301114965952, 13.5301114965952, 13.5301114965952, 13.5301114965952, 189.42156095233278, 27.0602229931904, 13.5301114965952, 13.5301114965952, 40.5903344897856, 54.1204459863808], [1.2548454674764364, 1.2548454674764364, 1.2548454674764364, 1.2548454674764364, 37.6453640242931, 1.2548454674764364, 1.2548454674764364, 46.42928229662817, 1.2548454674764364, 1.2548454674764364 … 3.5771064837982873, 3.5771064837982873, 3.5771064837982873, 3.5771064837982873, 50.07949077317602, 7.154212967596575, 3.5771064837982873, 3.5771064837982873, 10.731319451394864, 14.30842593519315], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 1.3061857958470844, 22.067282649041264, 1.3061857958470844, 1.3061857958470844, 27.078581889467454, 1.3061857958470844, 1.3061857958470844 … 2.631055234104207, 2.631055234104207, 2.631055234104207, 2.631055234104207, 29.16105652080971, 4.671824563850785, 2.631055234104207, 2.631055234104207, 6.712593893597363, 8.75336322334394], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0002669575553746345, 0.0002669575553746345, 0.0002669575553746345, 0.0002669575553746345, 0.004510099442574866, 0.0002669575553746345, 0.0002669575553746345, 0.005534306105002511, 0.0002669575553746345, 0.0002669575553746345 … 0.0005377336636068607, 0.0005377336636068607, 0.0005377336636068607, 0.0005377336636068607, 0.005959921157991423, 0.0009548250093287502, 0.0005377336636068607, 0.0005377336636068607, 0.0013719163550506399, 0.0017890077007725292], [0.00014477444553726425, 0.00014477444553726425, 0.00014477444553726425, 0.00014477444553726425, 0.0024458837480751893, 0.00014477444553726425, 0.00014477444553726425, 0.003001323924549862, 0.00014477444553726425, 0.00014477444553726425 … 0.00029161974039713625, 0.00029161974039713625, 0.00029161974039713625, 0.00029161974039713625, 0.003232140329885576, 0.000517813631896247, 0.00029161974039713625, 0.00029161974039713625, 0.0007440075233953581, 0.0009702014148944687]), 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.99999999999, 134635.75553779321], [72421.99999999999, NaN], [64900.92049553801, 132977.54785952627], [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.147776884874, -2636.2694500373796], [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.15606232380713, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261889, 3385.10708496425, 3275.982679763442, 3256.1983726130725, 1000.8740113003423, 544.8396657162824, 260.686904365387, 434.10597511342854, 136.99722836422484, 504.9046295086171], [1318.4256343029067, 534.8893302842547, 10.188014506791214, 430.35757803851186, 4061.234729603041, 703.8444909093937, 1678.5044809222738, 1405.0076647566113, 638.9482002041658, 953.1104205676534 … 1572.6135014677272, 4911.9277513608695, 3791.2114940820998, 4655.199689084512, 1438.8744570867193, 773.910301490728, 411.0040642111517, 726.4017205986705, 240.03110727421833, 711.8364497983174]], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380713, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261889, 3385.10708496425, 3275.982679763442, 3256.1983726130725, 1000.8740113003423, 544.8396657162824, 260.686904365387, 434.10597511342854, 136.99722836422484, 504.9046295086171], [518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380713, 403.4899392954506, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261889, 3385.10708496425, 3275.982679763442, 3256.1983726130725, 1000.8740113003423, 544.8396657162824, 260.686904365387, 434.10597511342854, 136.99722836422484, 504.9046295086171]]))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, 4, 5, 6, 7 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 4, 1, 1, 1, 1, 1, 25, 1 … 2, 1, 1, 2, 3, 16, 4, 3, 2, 3], [10.822026659306621, 10.822026659306621, 43.288106637226484, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 270.5506664826655, 10.822026659306621 … 23.976206776597902, 11.988103388298951, 11.988103388298951, 23.976206776597902, 35.96431016489685, 191.80965421278322, 47.952413553195804, 35.96431016489685, 23.976206776597902, 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, 43.288106637226484, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 10.822026659306621, 270.5506664826655, 10.822026659306621 … 23.976206776597902, 11.988103388298951, 11.988103388298951, 23.976206776597902, 35.96431016489685, 191.80965421278322, 47.952413553195804, 35.96431016489685, 23.976206776597902, 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, 1192.6146341463414, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 298.15365853658534, 7453.841463414634, 298.15365853658534 … 158.41666666666669, 79.20833333333334, 79.20833333333334, 158.41666666666669, 237.625, 1267.3333333333335, 316.83333333333337, 237.625, 158.41666666666669, 237.625], [7.65511425407355, 7.65511425407355, 30.6204570162942, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 7.65511425407355, 191.37785635183874, 7.65511425407355 … 8.114973344694128, 4.057486672347064, 4.057486672347064, 8.114973344694128, 12.172460017041193, 64.91978675755303, 16.229946689388257, 12.172460017041193, 8.114973344694128, 12.172460017041193], [94.08074124608004, 94.08074124608004, 376.32296498432015, 94.08074124608004, 94.08074124608004, 94.08074124608004, 94.08074124608004, 94.08074124608004, 2352.018531152001, 94.08074124608004 … 49.98750476142278, 24.99375238071139, 24.99375238071139, 49.98750476142278, 74.98125714213415, 399.9000380913822, 99.97500952284555, 74.98125714213415, 49.98750476142278, 74.98125714213415], [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.384292053067014, 12.384292053067014, 49.53716821226806, 12.384292053067014, 12.384292053067014, 12.384292053067014, 12.384292053067014, 12.384292053067014, 309.6073013266753, 12.384292053067014 … 27.06022299319041, 13.530111496595206, 13.530111496595206, 27.06022299319041, 40.59033448978562, 216.4817839455233, 54.12044598638082, 40.59033448978562, 27.06022299319041, 40.59033448978562], [1.2548454674764358, 1.2548454674764358, 5.019381869905743, 1.2548454674764358, 1.2548454674764358, 1.2548454674764358, 1.2548454674764358, 1.2548454674764358, 31.371136686910884, 1.2548454674764358 … 7.154212967596574, 3.577106483798287, 3.577106483798287, 7.154212967596574, 10.731319451394862, 57.23370374077259, 14.308425935193148, 10.731319451394862, 7.154212967596574, 10.731319451394862], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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.306185795847084, 1.306185795847084, 3.453885470315446, 1.306185795847084, 1.306185795847084, 1.306185795847084, 1.306185795847084, 1.306185795847084, 18.487783191593973, 1.306185795847084 … 4.671824563850784, 2.631055234104207, 2.631055234104207, 4.671824563850784, 6.7125938935973615, 33.24259518030286, 8.753363223343937, 6.7125938935973615, 4.671824563850784, 6.7125938935973615], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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.889212387273576, 11.889212387273576, 31.438083348064524, 11.889212387273576, 11.889212387273576, 11.889212387273576, 11.889212387273576, 11.889212387273576, 168.2801800736011, 11.889212387273576 … 42.52405335619368, 23.948487711601807, 23.948487711601807, 42.52405335619368, 61.09961900078557, 302.58197238047995, 79.67518464537744, 61.09961900078557, 42.52405335619368, 61.09961900078557], [6.447669663541781, 6.447669663541781, 17.04926867150509, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 6.447669663541781, 91.26046172724824, 6.447669663541781 … 23.06132987320929, 12.987566600381651, 12.987566600381651, 23.06132987320929, 33.13509314603693, 164.09401569279623, 43.20885641886457, 33.13509314603693, 23.06132987320929, 33.13509314603693]), BeforeIT.Bank(89460.0, 6476.292527744361, 0.0, 126431.00000000003, 0.028359903595743693, 3695.369633667523, 0.0, 0.0, 0.0, 0.0, 33636.12938055409, 18241.29672694816), 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.236265986638], [15944.236265986638], [15944.236265986638], [15944.236265986638], [3173.2320350842083], [3173.2320350842083], [34195.564496956766], [34195.564496956766], [33097.63671130043], [33097.63671130043], [29576.147776884867], [34346.71094688275], [28335.329312139664], [978.0617717704336], [0.0019383188997990075], [2.3548476e6], [0.0016459319014481277], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.48993929545054, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261888, 3385.10708496425, 3275.9826797634414, 3256.198372613072, 1000.8740113003423, 544.8396657162823, 260.686904365387, 434.1059751134285, 136.99722836422484, 504.9046295086172]], [[518.0834390395164, 258.24326637797435, 3.3621685784258726, 191.50743866702484, 1143.221494670442, 245.15606232380716, 403.48993929545054, 384.7628088630399, 236.96603753924677, 46.741075546466895 … 998.4526557261888, 3385.10708496425, 3275.9826797634414, 3256.198372613072, 1000.8740113003423, 544.8396657162823, 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")