-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheconsim.nlogo
1516 lines (1393 loc) · 32.1 KB
/
econsim.nlogo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
breed [persons person]
breed [corporations corporation]
breed [banks bank]
breed [national_banks national_bank]
breed [houses house]
turtles-own [capital funding workers wage price supply state inflation bank_rate firm_spent person_spent dividents bank_employers capital_gains dividends]
globals[fed bond]
to startup ;special procedure in netlogo that runs whatever code you put here automatically when the .nlogo file is opened
end
to setup
ca
set fed [1]
reset-timer
create-corporations 10
[set shape "corporation"
set funding 100
set_funding
set workers 4
set size 5
setxy random-xcor random-ycor
set heading 0
set price 5.00
set supply 1000 * (count corporations)
]
create-persons 50
[set shape "person"
set_capital
]
create-banks 2
[set shape "bank"
set funding ((capital * ((count persons) / 2)) / 10)
set size 0
setxy random-xcor random-ycor
set bank_rate 2
set capital_gains required_reserve_ratio * 10
set dividends funding / (capital_gains + 0.01)
]
ask turtles[setup-plots]
end
to go
;ask persons[face]
ask turtles[setup-plots
if price < equilibrium_price[
set price price + 0.1
]
if price > equilibrium_price[
set price price - 0.1
]
if supply < equilibrium_quantity[
set supply supply + 0.1
]
if supply > equilibrium_quantity[
set supply supply - 0.1
]
]
ask persons[set_capital]
let h []
let j []
ask corporations[set h fput xcor h]
ask corporations[set j fput ycor j]
ask corporations[if funding > 1000[ask persons[setxy item random(length h) h item random(length j) j]]]
ask corporations[ask persons in-radius 3[set state "working"]]
ask persons[if state != "working"[set capital 0]]
ask persons[if capital < 2[set state "unemployed" setxy random-xcor random-ycor]]
ask persons[if funding < 2000[if random(1) > 0[set state "unemployed" setxy random-xcor random-ycor]]]
ask persons[if capital > lb_threshold and capital < mb_threshold[set capital
capital - (lb_income_tax_rates * capital)]]
ask persons[if capital >= mb_threshold and capital <= hb_threshold[set capital capital - (lb_income_tax_rates * capital)]]
ask persons[if capital > hb_threshold[set capital capital - (lb_income_tax_rates * capital)]]
;every 5[create-persons 50
; [set shape "person"
; set_wage
; set capital wage
; ]
;]
end
to free_bank
set corporate_tax_rates 0
set set_stimulus 0
end
to abolish_fed
set fed []
end
to-report average_capital
let h []
ask persons[set h fput capital h]
report mean h
end
to-report equilibrium_price; ((a - c) / (b + d))
let a price + (average_capital / 100)
let b 1.75 ; elastic
let f price - (average_capital / 100)
let d 1.75 ; elastic
let p ((a - f) / (b + d))
ifelse p <= 0[report (p + (b))][
report p]
end
to-report equilibrium_quantity; (ad + bf/(b + d))
let a price + (average_capital / 100)
let b 1.75 ; elastic
let f price - (average_capital / 100)
let d 1.75 ; elastic
let p ((a * d + b * f)/(b + d))
report p
end
to-report demand_curve; P = a - bQd a is the highest price anyone would pay(reservation pay; remember paying anything less is a consumer surplus for the buyer which is (reservation price - market price)) and b is the slope (P = 0)
let a price + (average_capital / 100)
let b 1.75 ; elastic
let d a / b
report d
end
to-report supply_curve; P = a - bQs a is the lowest price anyone would sell and b is the slope (p = 0)
let a price - (average_capital / 100)
let b 1.75 ; elastic
let d a / b
report d
end
to-report demand
report price
end
to wiggle
fd 5
rt 15
lt 15
end
to stimulus
ask turtles[
set capital capital + (set_stimulus)
; ]
; every 3[set capital capital - (set_stimulus / 2.5)
; set price price - 2
; set entitlement_spending entitlement_spending - 10
; ]
; ]
]
;add: increases the inflation rate to 5%, and increases capital, along with workers. But lowers wage and after 7 seconds inflation and worker increase stops and GDP goes down.
end
to gold
set inflation inflation_rate + 0.25 set price price + 0.25
;reduces inflation rate/increase in percentage of capital to 0.25% from 2%
end
to austerity
ask turtles[
if entitlement_spending > 1[set entitlement_spending ((%_gov_cuts / 100) * entitlement_spending)]
if entitlement_spending < 1[set entitlement_spending 0]
]
; if timer < 7[set capital capital - 5
; set price price - 1
; set entitlement_spending entitlement_spending - 10
; ]
; if timer >= 7[set capital capital + 6
; set price price + 2
; set entitlement_spending entitlement_spending + 4
; ]
; ]
;lowers government spending and raises tax rates
end
to nit
ask persons[if capital < lb_threshold[set lb_income_tax_rates 0]
if capital >= lb_threshold / 10 and capital <= mb_threshold[set lb_income_tax_rates 5]]
end
to deregulate
;lowers corporate tax 2% every year for 10 years and gets rid of cap on recapitalization limits and lowers mininum wage to $5.50
end
to regulate
;hightens corporate tax 2% every year for 10 years sets limit to 1 company and has a mininum wage of $10
end
to recapitalize
ask corporations[if funding <= 1000[set state "bankrupt"]
if state = "bankrupt"[
die
ask corporation 0[
set funding funding + 1000
]
]
]
create-corporations 1
[set shape "corporation"
set funding 100
set_funding
set workers 4
set size 5
setxy random-xcor random-ycor
set price 5.00
set supply 1000 * (count corporations)
]
end
to-report unemployment_rate
report ((count persons with[ capital < 2.5]) / (count turtles) * 100)
end
to set_capital
ifelse random(50) > 40
[set capital mininum_wage + 20]
[ifelse random(50) > 5
[set capital mininum_wage]
[set capital 0]
]
end
to-report number_lb_people
report count persons with[ capital > lb_threshold and capital < mb_threshold]
end
to-report number_mb_people
report count persons with[ capital > mb_threshold and capital < hb_threshold]
end
to-report number_hb_people
report count persons with[ capital > hb_threshold]
end
to-report tax_revenue
report (lb_income_tax_rates * number_lb_people) + (mb_income_tax_rates * number_mb_people) + (hb_income_tax_rates * number_hb_people) + (corporate_tax_rates * count corporations) + (capital_gains_tax_rates * count persons)
end
to-report deficit
let q 0
set q (entitlement_spending - tax_revenue)
report q
end
to-report debt
let q 0
let h deficit
every 2[set q h]
report q
end
to-report inflation_rate
let A price; price
let B price + 2; CPI
report ((( B - A) / (A + 1.01)) * 100)
end
to-report CPI ;Consumer_Price_Index
report price + 2; not correct value
end
to-report aggregate_capital
report ((capital * count persons) - ((lb_income_tax_rates * number_lb_people) + (mb_income_tax_rates * number_mb_people) + (hb_income_tax_rates * number_hb_people) + (capital_gains_tax_rates * count persons)))
end
to-report C ;private_consumption or C = C0 + C1((y)^d) where c0 is autonomous spending if income levels were zero c1 is the marginal propensity to consume
report ((total_saving - total_borrowing) * count persons) + (MPC * aggregate_capital)
end
to-report M
report (supply * price)
end
to-report Government_spending
report entitlement_spending
end
to-report total_borrowing
report capital
end
to-report total_saving
report capital / 50
end
to-report total_income
report aggregate_capital
end
;to-report MPC ;marginal propensity to consume
; report change_in_consumption / change_in_income
;end
;to-report change_in_consumption
; let h ((aggregate_capital) / (5 * 50))
; report h
;end
to-report change_in_savings
let h (total_saving * ((count persons) + 1))
if timer <= 4[
report h]
if timer > 5[let z ((total_saving * ((count persons) + 1)) - h)
report z]
let z (total_saving * ((((count persons) + 1)) - h))
report z
end
to-report change_in_income
let h (aggregate_capital * ((count persons) + 1))
if timer <= 5[
report h]
if timer > 5[let z ((aggregate_capital * ((count persons) + 1)) - h)
report z]
let z (total_saving * (((aggregate_capital * ((count persons) + 1)) - h)))
report z
end
to-report MPS; slope of savings schedule
report change_in_savings / (change_in_income + .000000001)
end
to-report MPC; slope of consumption schedule
report (1 - MPS)
end
;to-report GDP
to-report aggregate_firm_spent
report ((capital * count corporations) + 1) / 40
end
to-report aggregate_person_spent
report ((capital * count persons) + 1) / 40
end
to-report invest_per_person
report 1
;report random(capital)
end
to-report I
report aggregate_firm_spent + aggregate_person_spent + invest_per_person
end
to-report G
report entitlement_spending
end
to set_funding
ask corporations[ifelse random(50) > 40
[set funding 100000]
[ifelse random(50) > 5
[set funding 50000]
[set funding 10000]
]]
end
to-report money_multiplier
report (1 / required_reserve_ratio)
end
to-report M1
ask turtles[report (aggregate_capital + capital_gains)]
end
to-report M2
ask turtles[report M1 + dividends]
end
to-report M3
ask turtles[report M2 + capital] ; fix to reflect large deposits
end
to-report aggregate_supply; Y = Y* + α·(P-Pe)
let y (C + G + I)
let a 0.6
let P price
let Pj equilibrium_price
report (y + a * (P - Pj))
end
to-report compensation_of_employees
report aggregate_capital
end
to-report rents
report (capital / 2)
end
to-report interest
report Fed_interest_rates
end
to-report corporate_profits
report corporate_tax_rates + (dividends * (count banks)) + funding
end
to-report GDP_income_approach
ask turtles[report Compensation_of_employees + Rents + Interest + Corporate_profits]
end
to-report national_income
report 0
end
to-report personal_income
report 0
end
to-report domestic_income
report 0
end
@#$#@#$#@
GRAPHICS-WINDOW
211
11
650
471
16
16
13.0
1
10
1
1
1
0
1
1
1
-16
16
-16
16
0
0
1
ticks
30.0
BUTTON
658
102
812
135
Nationalize the Banks!
stimulus
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
51
271
115
304
NIL
Setup
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
51
321
114
354
NIL
Go
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
TEXTBOX
660
48
809
97
Keynesian:\nRemember, in the long run we're all dead!
12
0.0
1
TEXTBOX
881
48
1031
78
Monetarist:\nInvest in Gold!
12
0.0
1
BUTTON
876
79
988
112
Hard Currency
ask turtles[gold]
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
PLOT
835
337
1074
487
Phillips Curve
Unemployment Rate
Inflation Rate
0.0
10.0
0.0
10.0
true
true
"set-plot-y-range min-pycor max-pycor" ""
PENS
"Unemp." 1.0 0 -5298144 true "ask turtles[plot unemployment_rate]" "ask turtles[plot unemployment_rate]"
"Inflat." 1.0 0 -15582384 true "ask turtles[plot inflation_rate]" "ask turtles[plot inflation_rate]"
PLOT
1227
705
1455
855
IS/LM
GDP
Interest Rates
0.0
15.0
0.0
15.0
true
true
"set-plot-y-range min-pycor max-pycor" ""
PENS
"GDP" 1.0 0 -5298144 true "ask turtles[plot C + G + I]" "ask turtles[plot C + G + I]"
"IR" 1.0 0 -14454117 true "ask turtles[plotxy fed_interest_rates (C + G + I) ]" "ask turtles[plotxy fed_interest_rates (C + G + I) ]"
SLIDER
11
184
195
217
corporate_tax_rates
corporate_tax_rates
0
100
100
1
1
NIL
HORIZONTAL
PLOT
1264
341
1498
491
Laffer Curve
Tax Revenue
Tax Rate
0.0
10.0
0.0
10.0
true
true
"set-plot-y-range min-pycor max-pycor" ""
PENS
"rev." 1.0 0 -5298144 true "plot tax_revenue" "plot tax_revenue"
"rate" 1.0 0 -14985354 true "plot lb_income_tax_rates" "plot lb_income_tax_rates"
BUTTON
656
277
811
312
Austerity
austerity
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
874
196
1045
229
Negative Income Tax
nit
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
PLOT
1076
94
1276
244
Price of Products
NIL
NIL
0.0
10.0
0.0
10.0
true
false
"" ""
PENS
"demand" 1.0 0 -14439633 true "ask turtles[plot demand]" "ask turtles[plot demand]"
PLOT
1305
95
1527
245
Quantity of Goods
NIL
NIL
0.0
10.0
0.0
10.0
true
false
"" ""
PENS
"Supply" 1.0 0 -14454117 true "ask turtles[plot supply]" "ask turtles[plot supply]"
SLIDER
288
675
474
708
fed_interest_rates
fed_interest_rates
0
15
6.7
0.1
1
NIL
HORIZONTAL
SLIDER
9
232
195
265
capital_gains_tax_rates
capital_gains_tax_rates
0
25
17
0.5
1
NIL
HORIZONTAL
SLIDER
77
485
273
518
lb_income_tax_rates
lb_income_tax_rates
0
100
50
1
1
NIL
HORIZONTAL
SLIDER
312
488
519
521
mb_income_tax_rates
mb_income_tax_rates
0
100
80
1
1
NIL
HORIZONTAL
SLIDER
556
488
758
521
hb_income_tax_rates
hb_income_tax_rates
0
100
78
1
1
NIL
HORIZONTAL
TEXTBOX
341
522
491
582
lb = lower bracket\nmb = middle bracket\nhb = high bracket\n
16
0.0
1
SLIDER
80
587
275
620
lb_threshold
lb_threshold
0
100
13
1
1
NIL
HORIZONTAL
SLIDER
306
587
513
620
mb_threshold
mb_threshold
0
100
21
1
1
NIL
HORIZONTAL
SLIDER
556
587
760
620
hb_threshold
hb_threshold
0
100
15
1
1
NIL
HORIZONTAL
TEXTBOX
1288
866
1438
905
GDP = private consumption + gross investment + government spending + (exports − imports)
10
0.0
1
SLIDER
8
370
201
403
entitlement_spending
entitlement_spending
0
100000
62360
1
1
NIL
HORIZONTAL
TEXTBOX
1168
528
1318
548
NIL
16
0.0
1
PLOT
795
705
1029
855
Income Inequality
Aggregate Pop.
Aggregate Wealth
0.0
10.0
0.0
10.0
true
true
"set-plot-y-range min-pycor max-pycor" ""
PENS
"Pop." 1.0 0 -5298144 true "ask persons[plot count turtles]" "ask persons[plot count turtles]"
"Wealth" 1.0 0 -14985354 true "ask turtles[plot aggregate_capital]" "ask turtles[plot aggregate_capital]"
TEXTBOX
1289
913
1439
955
Since the simulation is a closed system, (exports - imports) = 0.
11
0.0
1
TEXTBOX
38
410
188
438
Money the Government spends on social services
11
0.0
1
SLIDER
659
142
824
175
set_stimulus
set_stimulus
0
100000
100000
1
1
NIL
HORIZONTAL
SLIDER
12
539
198
572
mininum_wage
mininum_wage
0
100
3
1
1
NIL
HORIZONTAL
PLOT
792
524
1029
674
Market Equilibrium
Tending Quantity
Tending Price
0.0
10.0
0.0
10.0
true
true
"set-plot-y-range min-pycor max-pycor" ""
PENS
"Q" 1.0 0 -5298144 true "ask turtles[plot equilibrium_quantity]" "ask turtles[plot equilibrium_quantity]"
"P" 1.0 0 -14454117 true "ask turtles[plot equilibrium_price]" "ask turtles[plot equilibrium_price]"
TEXTBOX
245
636
465
676
= = FED/Monetary Policy = =
16
0.0
1
SLIDER
12
674
256
707
required_reserve_ratio
required_reserve_ratio
0
100
26
1
1
NIL
HORIZONTAL
SLIDER
654
328
823
361
%_gov_cuts
%_gov_cuts
0
100
40
1
1
NIL
HORIZONTAL
PLOT
1226
522
1452
672
AD-AS Model
GDP
Price
0.0
10.0
0.0
10.0
true
true
"set-plot-y-range min-pycor max-pycor" ""
PENS
"AD" 1.0 0 -5298144 true "ask turtles[plot (C + G + I)]" "ask turtles[plot (C + G + I)]"
"AS" 1.0 0 -14070903 true "ask turtles[plotxy (C + G + I) aggregate_supply ]" "ask turtles[plotxy (C + G + I) aggregate_supply ]"
TEXTBOX
1084
344
1228
476
The Phillips Curve is the short term phenomenom between the way inflation and unemploymet relate to each other after a massive influx in capital. Add a stimulus or 2 to see it in action!
12
0.0
1
TEXTBOX
34
11
184
180
WELCOME:\nKey terms:\nCapital: Money\nCapital gains: Money earned through investments\nCorporations: Businesses\nEntitlement: Social services\nMininum Wage: Lowest salary allowed\nThreshold: Mininum amount a tax rate applies to\nLook around and explore the other notes!
10
0.0
1
TEXTBOX
513
670
759
778
The FED, or Federal Reserve, controls monetary policy. I.e. it dictates how much a bank can borrow and how much money must be in a bank.
12
0.0
1
TEXTBOX
46
712
196
832
The reserve requirement is the mininum number of deposits or invetsments that a bank must have.
12
0.0
1
TEXTBOX
664
186
822
271
Adds more money into the economy, inreases the value of each prices all around since people have more money to spend(inflation)
12
0.0
1
TEXTBOX
666
370
816
461
Decreases entitlement spending(and is done in conjugation with tax rate increases) It could also lead to a drop in capital and thus slower inflation.
12
0.0
1
TEXTBOX
882
119
1032
181
Backs each dollar introduced with gold, lowering inflation rates dramatically.
12
0.0
1