; Gibson and Setterfield code for Real and financial crises in the Keynes-Kalecki structuralist model: An agent-based approach extensions[matrix] globals [ log-price returns volatility n-iteration t-count n-Node delta ; depreciation GDPL ; lagged GDP share-weight ; weight for links in financial network time-unit financial-constraint ; financial constraint for sensitivity analysis one-ply two-ply ; second round of borrowing for sensitivity analysis endogenous-money ; surplus firms can always invest even if the liquidity of their FA is already loaned out. recontracting ; can financial agents use liquidity for new loans when committed loans fall through in the same sweep? price-response-to-returns price-response-to-growth run-years preferential-attachment n-financial-agents n-denied ; number of frustrated borrowers ; lists c_list ; list of weights on private signal p_list ; list of prices u_list ; list of capacity utilizatoin tolerance ; discrepancy between total savings and total investment dbug patch-count one-ply-count two-ply-count zero-ply-count ask-turtles-here-count link-lender_list local-lender_list ] patches-own [ K ; capital stock s ; savings rate l ; direct labor coefficient v ; capital output ratio X ; gross value of production QL ; lagged capacity Q ; capacity u ; capaicty utilization r ; profit rate a_0 ; autonomous coef in accumluation function a_1 ; capacity coef in accumulation function a_2 ; profit coef in accumualtion function n-financial-agents-here ; number of financial agents per firm fin-surplus u_tmp ; temporary capacity utilization lambda ; demand share g ; rate of growth of capital stock invest ; investing this period ] turtles-own [ forecast ; forecast based on variable combination of private and public signal shares ; share of capital stock controlled by financial agent kappa ; weight on private signal in forming forecast gamma_0 ; parameters for smoothing function in forecast gamma_1 ; parameters for smoothing function in forecast partner ; linked neighbors sigma ; confidence in forecast private-signal ; private signal public-signal ; public signal memory ; data base for forecase forecast-history ; forecast history n-lags ; number of lags in forecasrt history data base liquidity ; fin-surplus deposited with financial agents but not yet borrowed liquidity-committed ; fin-surplus committed as part of a financing package dbug1 dbug2 ] ;;;;;;;;;;;;;;;;;;;;;; ;; Setup Procedures ;; ;;;;;;;;;;;;;;;;;;;;;; to setup setup-globals setup-network setup-turtles setup-patches end to setup-globals clear-all set tolerance 0.000001 set n-financial-agents 1000 set time-unit 50 ; weeks per year set log-price 2.5 set-default-shape turtles "circle" set delta 0.05 / time-unit set u_list [ ] set p_list [ ] set c_list [ ] set price-response-to-returns 0.1 set price-response-to-growth 0.00005 set run-years 75 set preferential-attachment TRUE set financial-constraint TRUE set share-weight TRUE set one-ply TRUE set two-ply FALSE set recontracting FALSE end to setup-network ; This section borrows from ; Wilensky, U. (2005). NetLogo Preferential Attachment model. http://ccl.northwestern.edu/netlogo/models/PreferentialAttachment. ; Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. ; Assistance from Paul Wright and Jonas Oppenheim is gratefully acknowledged. make-node nobody make-node turtle 0 ifelse preferential-attachment = TRUE [ repeat n-financial-agents - 2 [ make-node set-partner] ] ; if false [ set t-count random 2 crt n-financial-agents - 2 [ set partner [ ] setxy random-xcor random-ycor set t-count t-count + 1 ] ask turtles [ if (count link-neighbors = 0) [ let partner_ one-of other turtles create-link-with partner_ let tmp [who] of partner_ set partner fput tmp partner set tmp [who] of self ask link-neighbors [ set partner fput tmp partner ] ] ] ] ; make sure every patch has at least one turtle let end? FALSE while [ any? patches with [ count turtles-here = 0 and end? = FALSE] ] [ if any? patches with [ count turtles-here > 1] [ let stranded one-of patches with [ count turtles-here = 0] let glutted one-of patches with [ count turtles-here > 1] ifelse (stranded = nobody) [ set end? TRUE] [ ifelse (glutted != nobody) [ ask glutted [ ask one-of turtles-here [ move-to stranded]]] [ print "insufficient financial agents" set end? TRUE] ] ] ] ask patches [ set n-financial-agents-here count turtles-here] end to setup-turtles ask turtles [ ; setup turtles set size 0.4 set memory [ ] set forecast-history [ ] ask links [ set color gray ] set liquidity random-float 1 set gamma_0 5 + 1 * random-float 1 set gamma_1 8 + 2 * random-float 1 set sigma 0.5 set kappa 1 / (1 + exp(gamma_0 - gamma_1 * (1 - sigma))) ; smoothing function for kappa set n-lags 3 + random 13 if random-float 1 > 0.5 [ set forecast 1] ] end to setup-patches ask patches [ set K sum [liquidity] of turtles-here set g (.05 + random-float 0.04 ) / time-unit set l 0.1 + random-float 0.5 set v (2 + random-float 2) * time-unit set Q K / v set u 1 set X u * Q set r (1 - l) * X / K set a_0 g / 2 set a_1 random-float g / 4 set a_2 (g - a_0 - a_1 * u) / r if random-float 1 > 0.5 [ set invest 1] ] ; set savings rate to get an initially balanced of saving and investment let sav-rate_0 sum [ a_0 * K + a_1 * v * X + a_2 * (1 - l) * X] of patches / sum [ ( 1 - l) * X] of patches ; global saving rate ask patches [ set s random-normal sav-rate_0 (.05 / sqrt (time-unit))] ; now scale s to get S = I and balanced SAM let tot-sav sum [ s * (1 - l) * X] of patches let tot-invest sum [ g * K] of patches let tot-Q sum [Q] of patches ask patches [ set s tot-invest / tot-sav * s set fin-surplus (s * r - g) * K set lambda Q / tot-Q ] ;type "SI_err " print SI_err ; lagged GDP arbitrary ask turtles [ set shares ([K] of patch-here / [ n-financial-agents-here] of patch-here) / sum [K] of patches ;for debug set liquidity random-float 0.005 ] recolor reset-ticks end to-report set-partner ; reporter to set partner on network let total random-float sum [ count link-neighbors] of turtles let partner_ nobody ask turtles [ let nc count link-neighbors if partner_ = nobody [ ifelse nc > total [ set partner_ self] [ set total total - nc] ] ] report partner_ end to make-node [ old-node] ; turtle procedure for setting up network crt 1 [ set color green set partner [ ] if old-node != nobody [ create-link-with old-node [ set color green ] ; position the new node near its partner move-to old-node let tmp [ who] of old-node set partner fput tmp partner set tmp [ who] of self ask old-node [ set partner fput tmp partner] fd 20 ] set n-Node n-Node + 1 ] end ; end setup procedures ;;;;;;;;;;;;;;;;;;;;; ;; Main Procedures ;; ;;;;;;;;;;;;;;;;;;;;; to go ; if (ticks = 0) [type " time started: " print time] if u_moving-average < 60 [ type "u_moving-average limit reached at " print time stop] if crash-history > 0 [ type "economy crashed at " print time stop] if ticks > run-years * time-unit [type "normal complettion at " print time stop] if ticks > 99 [type "normal complettion at " print time stop] clear-financial-market fin-surplus-firms-invest set-finance-for-deficit-firms redistribute-demand tot_inv set-investment-to-savings update-lagged-variables ; recolor tick end to fin-surplus-firms-invest; patch procedure ask patches [ ifelse (fin-surplus >= 0 ) [set invest 1] [set invest 0] ] end to set-finance-for-deficit-firms; patch procedure ; fin-surpluses of firms (patches) remains fixed during this procedur let loan-still-needed 0 let local-lender nobody let local-lender-count 0 let link-lender-count 0 let link-lender nobody set n-denied 0 let search 0 if (financial-constraint) = TRUE [ ask patches [ ifelse (fin-surplus >= 0) [set invest 1] [set invest 0] ] type "looking for loans " print time ask patches with [fin-surplus < 0] [ set local-lender one-of turtles-here with [forecast > 0] ifelse (local-lender != nobody) ; look for loan [ set local-lender-count 0 set local-lender_list [] let loan -1 * fin-surplus set loan-still-needed loan print " " type "--->new borrower is " type pxcor type " " type pycor type " with loan request of " print loan type "Local lenders here = " print count turtles-here with [forecast > 0] ask turtles-here [ type "Local lender " type who type " with liquidity " type liquidity type " and forecast " print forecast type "...with already committed liquidity of " type liquidity-committed type " and link neighbors " print [who] of link-neighbors ] set local-lender one-of turtles-here with [liquidity - liquidity-committed > 0 and forecast > 0 ] while [loan-still-needed > 0 and local-lender != nobody] [ set local-lender one-of turtles-here with [liquidity - liquidity-committed > 0 and forecast > 0] ifelse local-lender != nobody [ set local-lender-count local-lender-count + 1 type "...randomly asking local-lender no " type local-lender-count print " for loan " let uncommitted-liquidity [liquidity - liquidity-committed] of local-lender ifelse (uncommitted-liquidity - loan-still-needed) < 0 ; uncommitted liquidity inadequate to cover loan request [ type "liquidity of local lender " type [who] of local-lender type " is inadequate " type " commits to partial loan only of " print uncommitted-liquidity set loan-still-needed loan-still-needed - uncommitted-liquidity ask local-lender [ set liquidity-committed liquidity set local-lender_list fput who local-lender_list ] ; local-lender commits rest of funds such that entire liquidity is committed. type "loans still needed = " print loan-still-needed ] ; uncommitted liquidity does cover loan request [ ask local-lender [ set liquidity-committed liquidity-committed + loan-still-needed set local-lender_list fput who local-lender_list ] set loan-still-needed 0 type " ***loan completed by local lender " type [who] of local-lender type " who commits to a loan of " print [liquidity-committed] of local-lender ] ] [ print "no more willing local lenders" ] ]; done with while ; one-ply if (one-ply = true and loan-still-needed > 0 and any? turtles-here with [forecast > 0]) [ type "-->go to link neighbors for loan of " print loan-still-needed set link-lender_list [] ask turtles-here with [forecast > 0] [ if loan-still-needed > 0 [ set link-lender one-of link-neighbors with [liquidity - liquidity-committed > 0] if link-lender != nobody [ type "link-lender available ..." set one-ply-count one-ply-count + 1 while [loan-still-needed > 0 and link-lender != nobody] [ set link-lender one-of link-neighbors with [liquidity - liquidity-committed > 0] ifelse link-lender != nobody [ set link-lender-count link-lender-count + 1 type " ask linked lender " type [who] of link-lender type " of local lender " type who type " with liquidity of " type [liquidity] of link-lender type " for loan of " print loan-still-needed let uncommitted-liquidity [liquidity - liquidity-committed] of link-lender ifelse ((uncommitted-liquidity - loan-still-needed) < 0 ) ; uncommitted liquidity of link lender inadequate to cover loan request [ print "liquidity of link lender " type [who] of link-lender type " of local lender " type who type " gives partial loan only of " print uncommitted-liquidity set loan-still-needed loan-still-needed - uncommitted-liquidity ask link-lender [ set liquidity-committed liquidity set link-lender_list fput who link-lender_list ] ; local-lender commits rest of funds such that entire liquidity is committed. type "loans still needed = " print loan-still-needed ] ; uncommitted liquidity of link lender does cover loan request [ ask link-lender [ set liquidity-committed liquidity-committed + loan-still-needed set link-lender_list fput who link-lender_list ] set loan-still-needed 0 type " ***loan completed by link lender " type [who] of link-lender type " commits to a loan of " print loan type " has " type [liquidity - liquidity-committed] of link-lender print " left to lend this sweep " ] ] [ type " no link-lenders have enough liquidity to complete loan-deny; type liquidity of link lender = " ] ]; done with while ]; done with is link-lender != nobody ]; if loan still needed ]; done with local lender ]; done with one ply if if recontracting = TRUE [ ask turtles with [liquidity-committed > 0] [ set liquidity liquidity - liquidity-committed set liquidity-committed 0 ] type " done with this borrower--now reduce liquidity by liquidity-committed " ] ifelse loan-still-needed > 0 [ set invest 0 set n-denied n-denied + 1 type "firm " type pxcor type " " type pycor print " cannot invest" ] [ set invest 1 type "firm " type pxcor type " " type pycor type " can invest using local lender(s): " type local-lender_list ifelse (one-ply-count > 0 ) [ type " and link lender(s) " print link-lender_list ] [ print "" ] ]; done with invest if loan is made if recontracting = FALSE [ ; now pay bills--reduce liquidity by liquidity-committed if deal has been made ask turtles with [liquidity-committed > 0] [ set liquidity liquidity - liquidity-committed set liquidity-committed 0 ] print " done with all borrowers--now reduce liquidity by liquidity-committed " ] ]; done with look for loan [ let loan -1 * fin-surplus print " " type "--->new borrower is " type pxcor type " " type pycor type " with loan request of " print loan set invest 0 set n-denied n-denied + 1 type "firm " type pxcor type " " type pycor print " cannot invest because no local-lender with positive forecast " ] ]; end financial surplus < 0 type "end of sweep " print time ] ; stop fin constraint end to deposit-fin-surplus-with-financial-agents; patch procedure ask turtles-here [set liquidity liquidity + fin-surplus / count turtles-here] end to redistribute-demand[ I]; patch procedure with K and Q constant ;type "-> redistributing demand " ;type " I = " print I ask patches [ set u_tmp lambda * aggregate_demand / (K / v) ; compute the proposed level of capacity utilitization if (u_tmp > 1) [ set u 1 set u_tmp 1] ; if at boundary, set proposed capacity utilization = 1 ] let tot-demand sum [u_tmp * K / v ] of patches ; update demand shares ask patches [ set lambda (u_tmp * K / v) / tot-demand ] ; now check for convergence let norm sum [ (u - u_tmp) * (u - u_tmp) ] of patches if n-Iteration >= 1000 [ print "Redistribute-demand error"] ; if not compute new demand and recompute ifelse norm > 1.0E-3 and n-iteration < 1000 [ set n-Iteration n-Iteration + 1 ask patches [set u u_tmp] ;print n-Iteration repeat 1 [Redistribute-demand I] ] [ set n-Iteration 0 ;type " redistribute demand converged at " ;print norm ask patches ; set new Xs based on demand redistribution [ set X u * Q ] ] end to set-investment-to-savings ; patch procedure ; eliminate small errors in savings and investment due to capacity constraints let g_ mean [ g] of patches while [ abs( aggregate_demand / GDP - 1) > 0.01 ] [ ;set dbug dbug + 1 ;print "-> adjusting g so the GDP = AD " ask patches with [ invest = 1] [ set g g * GDP / aggregate_demand] ;type " scale investment to be consistent with GDP by " print (mean [ g] of patches / g_ - 1) Redistribute-demand (tot_Inv) ] end to set-forecast; turtle procedure to set forecast ; compute weight on private signal first if (returns * private-signal > 0 and public-signal * returns < 0) ; financial agent beats market [ set forecast-history lput 1 forecast-history] if (returns * private-signal < 0 and public-signal * returns > 0) ; market beat financial agent [ set forecast-history lput 0 forecast-history] ; if (returns * private-signal * public-signal * returns >= 0) ; same sign no change [ set forecast-history lput .5 forecast-history] ; if length forecast-history > n-lags [ set forecast-history butfirst forecast-history] ; compute sigma based on set sigma sum forecast-history / length forecast-history ; set kappa weights on private signal set kappa 1 / (1 + exp(gamma_0 - gamma_1 * (1 - sigma))) ; set weight on private signal set private-signal set-private_sig set public-signal set-public_sig if ticks < 16 [ set private-signal 0 set log-price 2.5] ;print public-signal set forecast kappa * public-signal + (1 - kappa) * private-signal + random-normal 0 1 end to clear-financial-market; turtle procedure let tot_shares sum [ shares] of turtles ask turtles [set-forecast] set price-response-to-returns price-response-to-returns + .00001 * sum[forecast] of turtles let tot_K sum [K] of turtles set log-price (log-price + price-response-to-returns * returns + price-response-to-growth * tot_K ^ 0.5) set p_list fput log-price p_list if length p_list > 250 [ set p_list butlast p_list] ifelse(share-weight = true) [ set returns sum [ forecast * shares] of turtles / tot_shares ] [ set returns sum [ forecast] of turtles / n-financial-agents ] end to update-lagged-variables; patch procedure ;print "->updating lagged variables" ;type " GDP lagged " print GDPL set GDPL GDP ;type " GDP " print GDP ask patches ; prepare for next round (order is important here) [ set r (1 - l) * X / K ;type " rate of profit is " print r if(invest = 0) [set g 0] set K K * ( 1 + g - delta) set QL Q set Q K / v set g a_0 + a_1 * u + a_2 * r if endogenous-money = FALSE [set fin-surplus (s * (1 - l) * X - g * K)] ] ;if (count patches - n-denied - count patches with [ invest = 1]) > 0 [ print "financial err!" stop] ; check for errors let tot_K sum [K] of patches ask turtles [ set shares ([K] of patch-here / [ n-financial-agents-here] of patch-here) / tot_K] ;set shares ask patches with [ fin-surplus > 0] [ deposit-fin-surplus-with-financial-agents] ;make deposits of fin-surplus with financial agents end to-report tot_Inv ; reports total investment let tot_Inv_ sum [g * K] of patches with [invest = 1] report tot_Inv_ end to-report GDP ; reports gross domestic product let GDP_ sum [u * K / v] of patches report GDP_ end to-report crash-history ; reports financial crash set p_list fput log-price p_list let build 0 let delta_p 0 let drawdown 0 if length p_list > 250 [ set p_list butlast p_list] if ticks > 250 ; wait until 250 periods and look backwards to see if crash has occured [ set build item 24 p_list set delta_p build - item 224 p_list set drawdown item 0 p_list set drawdown item 24 p_list - drawdown ] ifelse (delta_p > 0 and drawdown > 0.5) [ report 1] [ report 0] end to-report aggregate_demand ; reports total aggregate demand let aggregate_demand_ (sum [(1 - s * (1 - l) ) * u * K / v ] of patches + tot_Inv ) report aggregate_demand_ end to-report set-private_sig ; reports private signal set memory lput [u] of patch-here memory ; has to be this way since order of time is important to regression if length memory > n-lags [ set memory butfirst memory] let private-sig_ item 2 matrix:forecast-linear-growth memory ifelse (private-sig_ >= -.001) ; positive slope implies positive forecast [report abs(private-sig_)] [report private-sig_] end to-report set-public_sig; reports public signal let link_neighbor_shares sum [shares] of link-neighbors let public-sig_ 0 ifelse(share-weight = TRUE) [ set public-sig_ sum[ forecast * shares] of link-neighbors / link_neighbor_shares] [ set public-sig_ sum[ forecast] of link-neighbors / count link-neighbors] report public-sig_ end to-report SI_err ; reports saving-investment error let SI_err_ sum [ s * (1 - l) * X] of patches - 1 * sum [ g * K] of patches with [ invest = 1] report SI_err_ end to-report average-u ; reports aggregate capacity utilization report 100 * sum [ u * K / v ] of patches / sum [ K / v] of patches end to-report u_moving-average ; reports moving average of aggregate capacity utilization set u_list fput average-u u_list if length u_list > 100 [ set u_list butlast u_list] report sum u_list / length u_list end to-report c_ma ; reports moving average of coupling coefficient kappa let tmp mean[ kappa] of turtles set c_list fput tmp c_list if length c_list > 15 [ set c_list butlast c_list] report sum c_list / length c_list end to recolor ask patches with [k > 0] [ifelse (fin-surplus > 0 ) [set pcolor 4] [set pcolor 7] ] ask turtles [ ifelse forecast > 0 [set color green ] [set color red ] ] end to-report time report date-and-time end @#$#@#$#@ GRAPHICS-WINDOW 217 11 745 540 -1 -1 20.0 1 10 1 1 1 0 1 1 1 0 25 0 25 1 1 1 ticks 30.0 BUTTON 2 10 69 43 NIL setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 152 10 215 43 NIL go T 1 T OBSERVER NIL NIL NIL NIL 1 PLOT 13 201 213 351 Price NIL NIL 0.0 1.0 0.0 1.0 true true "" "" PENS "p" 1.0 0 -16777216 true "" "plot (log-price)" PLOT 970 161 1170 311 Volatility NIL NIL 0.0 10.0 0.0 1.0 true false "" "" PENS "volatility" 1.0 0 -16777216 true "" "plot (abs(returns))" PLOT 770 162 970 312 Returns NIL NIL 0.0 10.0 0.0 1.0 true false "" "" PENS "returns" 1.0 0 -16777216 true "" "plot(returns)" BUTTON 70 10 151 43 go once go NIL 1 T OBSERVER NIL NIL NIL NIL 1 MONITOR 640 561 699 606 Forecast mean [forecast] of turtles 5 1 11 PLOT 963 11 1163 161 Degree Distribution NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "default" 1.0 1 -16777216 true "" "" PLOT 769 10 969 160 Degree Distribution (log-log) log(degree) log(# of nodes) 0.0 0.3 0.0 0.3 true false "" "" PENS "default" 1.0 0 -16777216 true "" "" MONITOR 1180 563 1242 608 kappa mean [kappa] of turtles 8 1 11 PLOT 1369 10 1569 160 Bulls NIL NIL 0.0 1000.0 0.0 120.0 true false "" "" PENS "bulls" 1.0 0 -2674135 true "" "plot (100 * count turtles with [forecast > 0] / count turtles)" "fifty" 1.0 0 -16777216 true "" "plot 50" PLOT 1167 10 1367 160 share distribution NIL NIL 0.0 0.01 0.0 50.0 false false "" "" PENS "default" 1.0 1 -16777216 false "" "" MONITOR 520 561 571 606 SIerr SI_err / GDP 5 1 11 MONITOR 284 608 339 653 K sum [K] of patches 2 1 11 MONITOR 469 609 547 654 ExcessDem aggregate_demand / GDP - 1 5 1 11 MONITOR 573 610 637 655 Investing count patches with [invest = 1] 17 1 11 MONITOR 574 562 636 607 Liquidity sum [liquidity] of turtles 1 1 11 PLOT 14 45 214 195 Average capacity utlization NIL NIL 0.0 10.0 0.0 10.0 true true "" "" PENS "u_avg" 1.0 0 -2674135 true "" "plot (average-u)" "u_ma" 1.0 0 -7500403 true "" "plot (u_moving-average)" MONITOR 1174 417 1235 462 GDP GDP 3 1 11 MONITOR 405 562 462 607 Deficit sum [fin-surplus] of\npatches with [fin-surplus < 0 ] 3 1 11 PLOT 771 311 971 461 Signal NIL NIL 0.0 10.0 0.0 1.0 true true "" "" PENS "pri" 1.0 0 -16777216 true "" "plot mean [private-signal] of turtles" "pub" 1.0 0 -2674135 true "" "plot mean [public-signal] of turtles" MONITOR 347 609 402 654 s sum [s *(1 - l) * X] of patches 3 1 11 MONITOR 406 608 472 653 AggDem aggregate_demand 5 1 11 PLOT 973 312 1173 462 GDP NIL NIL 0.0 1.0 0.0 1.0 true true "" "let AD aggregate_demand" PENS "GDP" 1.0 0 -16777216 true "" "plot(GDP)" "AD" 1.0 0 -2674135 true "" "plot(aggregate_demand)" PLOT 1173 162 1373 312 Loan Denied NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "nRed" 1.0 0 -16777216 true "" "plot (n-denied / count turtles with [fin-surplus < 0] * 100)" MONITOR 283 560 340 605 Q sum [K / v] of patches 17 1 11 MONITOR 344 563 403 608 Surplus sum [fin-surplus] of patches with [fin-surplus >= 0] 3 1 11 PLOT 976 463 1176 613 Coupling & Confidence NIL NIL 0.0 1.0 0.0 1.0 true true "" "let Coupling mean[kappa] of turtles\nlet Confidence mean[sigma] of turtles" PENS "Coupling" 1.0 0 -16777216 true "" "plot (mean[kappa] of turtles)" "Confidence" 1.0 0 -2674135 true "" "plot (mean[sigma] of turtles)" MONITOR 279 751 336 796 Fin financial-constraint 17 1 11 MONITOR 209 751 277 796 Pref Attach Preferential-attachment 17 1 11 MONITOR 12 350 69 395 Price log-price 3 1 11 MONITOR 339 751 431 796 share weight share-weight 17 1 11 MONITOR 642 609 716 654 Confidence mean[sigma] of turtles 17 1 11 MONITOR 700 562 759 607 returns returns 3 1 11 MONITOR 461 562 518 607 Surplus sum [fin-surplus] of patches 3 1 11 TEXTBOX 208 729 358 747 Settings 11 0.0 1 MONITOR 1375 267 1445 312 frustated n-denied 17 1 11 MONITOR 1180 515 1237 560 sigma mean[sigma] of turtles 17 1 11 MONITOR 38 475 100 520 one-ply one-ply-count 17 1 11 MONITOR 39 427 105 472 zero-ply zero-ply-count 17 1 11 @#$#@#$#@ @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 6.0.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup go log-price crash-history mean [kappa] of turtles n-denied GDP u_moving-average mean [public-signal] of turtles mean [private-signal] of turtles zero-ply-count one-ply-count two-ply-count @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@