globals [ ; number-of-repeats month-counter run-counter monthlyCost ; savers and borrowers potentialBorrowers nOfNewBorrowers nOfDefaulters ;initialSavings maxPossibleLendingAtEndOfMonth totalCapitalRepayments totalBorrowersInterestPayments totalRepayments ; interest plus capital totalSavings newLoanSupply newLoansAvailable banksSpareCash totalNewLoans loanError maxRWA maxTotalRiskWeightedExposure maxLendingAllowed nOfLoans totalLoans monthlyLoanRate loanTermMonths monthlySaversrate totalSaversInterestPayments totalSavingsAtStartOfMonth totalSavingsAtEndOfMonth totalBorrowingAtStartOfMonth totalBorrowingAtEndOfMonth totalCurrentProfit totalBadDebts totalRetainedProfit monthLoansStop ; macro totalExpenditure ; banks loanSize riskWeightLiquid% riskWeightMortgages% riskWeightConsumerLoans% riskWeightLoan% totalCapitalAtEndOfMonth totalInitialDeposits totalDepositsAtStartOfMonth totalDepositsAtEndOfMonth totalBanksRequiredLiquidity totalBanksLiquidity incomeOnLiquidAssets totalLendingAtStartOfMonth totalLendingAtEndOfMonth reserveRatio% totalLiabilitiesAtEndOfMonth totalAssetsAtEndOfMonth overallBalanceAtEndOfMonth overallBalanceAtStartOfMonth totalCapital totalRiskWeightedExposure capitalAdequacyRatio% carConstraintIndicator bankDepositMultiplier check ; data collection ;12 months reserveRatio%12 accumReserveRatio%12 capitalAdequacyRatio%12 accumCapitalAdequacyRatio%12 bankDepositMultiplier12 accumBankDepositMultiplier12 totalLiabilitiesAtEndOfMonth12 totalAssetsAtEndOfMonth12 totalRetainedProfit12 totalLendingAtEndOfMonth12 accumTotalLiabilitiesAtEndOfMonth12 accumTotalAssetsAtEndOfMonth12 accumTotalRetainedProfit12 accumTotalLendingAtEndOfMonth12 totalNewLoans12 accumTotalNewLoans12 totalExpenditure12 accumTotalExpenditure12 totalRepayments12 accumTotalRepayments12 borrowers12 accumBorrowers12 savers12 accumSavers12 potentialBorrowers12 accumPotentialBorrowers12 avSavings12 accumAvSavings12 ; 60 months reserveRatio%60 accumReserveRatio%60 capitalAdequacyRatio%60 accumCapitalAdequacyRatio%60 bankDepositMultiplier60 accumBankDepositMultiplier60 totalLiabilitiesAtEndOfMonth60 totalAssetsAtEndOfMonth60 totalRetainedProfit60 totalLendingAtEndOfMonth60 accumTotalLiabilitiesAtEndOfMonth60 accumTotalAssetsAtEndOfMonth60 accumTotalRetainedProfit60 accumTotalLendingAtEndOfMonth60 totalNewLoans60 accumTotalNewLoans60 totalExpenditure60 accumTotalExpenditure60 totalRepayments60 accumTotalRepayments60 borrowers60 accumBorrowers60 savers60 accumSavers60 potentialBorrowers60 accumPotentialBorrowers60 avSavings60 accumAvSavings60 ;120 months reserveRatio%120 accumReserveRatio%120 capitalAdequacyRatio%120 accumCapitalAdequacyRatio%120 bankDepositMultiplier120 accumBankDepositMultiplier120 totalLiabilitiesAtEndOfMonth120 totalAssetsAtEndOfMonth120 totalRetainedProfit120 totalLendingAtEndOfMonth120 accumTotalLiabilitiesAtEndOfMonth120 accumTotalAssetsAtEndOfMonth120 accumTotalRetainedProfit120 accumTotalLendingAtEndOfMonth120 totalNewLoans120 accumTotalNewLoans120 totalExpenditure120 accumTotalExpenditure120 totalRepayments120 accumTotalRepayments120 borrowers120 accumBorrowers120 savers120 accumSavers120 potentialBorrowers120 accumPotentialBorrowers120 avSavings120 accumAvSavings120 ] breed [ households household ] breed [ banks bank ] households-own [ budget potentialBorrower ownExpenditureThisMonth ownTotalSavings saversInterestPayment spentLoan ownOutstandingBorrowing newLoan ownLoan seller monthlyRepayment borrowersInterestPayment capitalRepayment defaulter loanRepaid ; from payment i.e. in excess of monthly repayments savingHistory borrowingHistory paymentHistory ] banks-own [ ; equityCapital initialDeposits deposits banksRequiredLiquidity banksActualLiquidity lending capital ; equityCapital badDebts assets liabilities balance riskWeightedExposure loanSupply ] ;_______________________________________________________________________________________________________________________________________ to setup ; to ensure density of agents is 1% if nofHouseholds = 1000 [ resize-world -157 157 -158 158 ] if nofHouseholds = 5000 [ resize-world -353 353 -353 353 ] if nofHouseholds = 10000[ resize-world -500 500 -500 500 ] clear-all ask patches [set pcolor white] set riskWeightLiquid% 0 set riskWeightMortgages% 50 set riskWeightConsumerLoans% 100 ; data recording ; 12 months set accumReserveRatio%12 [ ] set accumCapitalAdequacyRatio%12 [ ] set accumBankDepositMultiplier12 [ ] set accumTotalLiabilitiesAtEndOfMonth12 [ ] set accumTotalAssetsAtEndOfMonth12 [ ] set accumTotalRetainedProfit12 [ ] set accumTotalLendingAtEndOfMonth12 [ ] set accumBorrowers12 [ ] set accumSavers12 [ ] set accumPotentialBorrowers12 [ ] set accumAvSavings12 [ ] set accumTotalNewLoans12 [ ] set accumTotalExpenditure12 [ ] set accumTotalRepayments12 [ ] ; 60 months set accumReserveRatio%60 [ ] set accumCapitalAdequacyRatio%60 [ ] set accumBankDepositMultiplier60 [ ] set accumTotalLiabilitiesAtEndOfMonth60 [ ] set accumTotalAssetsAtEndOfMonth60 [ ] set accumTotalRetainedProfit60 [ ] set accumTotalLendingAtEndOfMonth60 [ ] set accumBorrowers60 [ ] set accumSavers60 [ ] set accumPotentialBorrowers60 [ ] set accumAvSavings60 [ ] set accumTotalNewLoans60 [ ] set accumTotalExpenditure60 [ ] set accumTotalRepayments60 [ ] ; 120 months set accumReserveRatio%120 [ ] set accumCapitalAdequacyRatio%120 [ ] set accumBankDepositMultiplier120 [ ] set accumTotalLiabilitiesAtEndOfMonth120 [ ] set accumTotalAssetsAtEndOfMonth120 [ ] set accumTotalRetainedProfit120 [ ] set accumTotalLendingAtEndOfMonth120 [ ] set accumBorrowers120 [ ] set accumSavers120 [ ] set accumPotentialBorrowers120 [ ] set accumAvSavings120 [ ] set accumTotalNewLoans120 [ ] set accumTotalExpenditure120 [ ] set accumTotalRepayments120 [ ] set monthlyLoanRate ( annualLoanRate% / 12 ) / 100 if loanType = "consumer loans" [ set loanTermMonths 36 set loanSize 5 set riskWeightLoan% riskWeightConsumerLoans% ] if loanType = "mortgages" [ set loanTermMonths 300 set loanSize 100 set riskWeightLoan% riskWeightMortgages% ] ifelse monthlyLoanRate > 0 [ set monthlyCost precision (( loanSize * monthlyLoanRate ) / (1 - (( 1 + monthlyLoanRate) ^ ( - loanTermMonths ))) ) 3 ] [ set monthlyCost precision ( loanSize / loanTermMonths ) 3 ] reset-ticks end ;-------------------------------------------------------------------------------------------------------- to go repeat number-of-runs [ ; at start ot each run reset-globals repeat number-of-months [ month-reset if number-of-months > 1 [ collect-debts if annualSaversRate% > 0 [ pay-interest-to-savers collect-interest-on-liquid-assets ] make-deposits ] make-loans spend-loans collect-data-at-end-of-month ] ] collect-data-at-end end ;_____________________________________________________________________________________________________________________ ; PROCEDURES ;_____________________________________________________________________________________________________________________ to reset-globals ; This cannot be done in setup because it needs to be done for each run. ; at start of run ; general set run-counter run-counter + 1 set month-counter 0 clear-turtles ; households create-households nOfHouseholds [ set shape "person" set color blue set size 5 setxy random-pxcor random-pycor if any? other turtles-here [ let empty-patches patches with [ not any? turtles-here ] if not any? empty-patches [ show "Run out of empty patches!"] move-to one-of empty-patches ] set defaulter "No" ; these are to assist debugging set savingHistory [ ] set borrowingHistory [ ] set paymentHistory [ ] ] ; from Chapter 3 budget distribution model, with minimum set at 350 and normalised to 1 000 ask households [ set budget 350 + random-exponential ( 1000 - 350 ) ] ; to normalise budget to average 1 000 and round to 3 decimal places let calculatedMeanBudget precision ( mean [ budget ] of households ) 3 ask households [ set budget budget * ( 1000 / calculatedMeanBudget ) ] ask households [ set budget precision ( budget / 1000 ) 3 ] ask n-of nOfSavers households [ set ownTotalSavings 10 set color black ] ask households [ set savingHistory lput ownTotalSavings savingHistory set borrowingHistory lput ownOutstandingBorrowing borrowingHistory set paymentHistory lput spentLoan paymentHistory] ; bank create-banks 1 [ set shape "pentagon" set color green set size 7 setxy 0 0 set initialDeposits sum [ ownTotalSavings ] of households set capital equityCapital set deposits initialDeposits set lending 0 set banksRequiredLiquidity precision ( ( deposits * targetReserveRatio% / 100 ) ) 0 ] set totalInitialDeposits sum [ initialDeposits ] of banks set totalDepositsAtStartOfMonth totalInitialDeposits set totalBorrowingAtStartOfMonth 0 set totalLendingAtStartOfMonth 0 set totalCurrentProfit 0 set totalBorrowersInterestPayments 0 set incomeOnLiquidAssets 0 set totalSaversInterestPayments 0 set totalBadDebts 0 set totalRetainedProfit 0 set totalBanksLiquidity 0 set totalBanksRequiredLiquidity 0 set banksSpareCash 0 set totalCapitalAtEndOfMonth 0 set totalAssetsAtEndOfMonth 0 set totalLendingAtEndOfMonth 0 set overallBalanceAtEndOfMonth 0 set totalRiskWeightedExposure 0 end ;------------------------------- to month-reset set month-counter month-counter + 1 set maxLendingAllowed 0 set newLoanSupply 0 set totalCurrentProfit 0 set totalExpenditure 0 set carConstraintIndicator 0 ask households [ set potentialBorrower "No" set loanRepaid 0 set ownExpenditureThisMonth 0 set seller 0 set newLoan "No" ] ask banks [ set badDebts 0 ] end ;-------------------------- to collect-debts ; does not run in first month ; banks collect regular repayments from borrowers ; if shock switched on then chosen per cent of borrowers default at chosen month if shock and month-counter = shock-month [ set nOfDefaulters precision (( defaulters% / 100 ) * ( count households with [ ownOutstandingBorrowing > 0 ] )) 0 ask n-of nOfDefaulters households with [ ownOutstandingBorrowing > 0 ] [ set defaulter "Yes" set monthlyRepayment 0 set borrowersInterestPayment 0 set capitalRepayment 0 ] set totalBadDebts precision sum [ ownOutstandingBorrowing ] of households with [ defaulter = "Yes" ] 0 ask households with [ defaulter = "Yes" ] [ set ownOutstandingBorrowing 0 ] ] ask households with [ ownOutstandingBorrowing > 0 and defaulter ="No" ] [ set borrowersInterestPayment precision ( ownOutstandingBorrowing * monthlyLoanRate ) 3 set capitalRepayment precision ( monthlyRepayment - borrowersInterestPayment ) 3 set ownOutstandingBorrowing precision ( ownOutstandingBorrowing - capitalRepayment ) 3 ] ask households [ set ownExpenditureThisMonth precision ( budget - monthlyRepayment ) 3 ] ; for households that have paid off all their debt ask households with [ ownOutstandingBorrowing <= 0 ] [ set ownOutstandingBorrowing 0 set ownLoan 0 set monthlyRepayment 0 set capitalRepayment 0 set borrowersInterestPayment 0 set color blue ] set totalRepayments precision sum [ monthlyRepayment ] of households 0 set totalCapitalRepayments precision sum [ capitalRepayment ] of households 0 set totalBorrowersInterestPayments precision sum [ borrowersInterestPayment ] of households 0 end ;--------------------- to pay-interest-to-savers ; banks pay interest to savers and savers leave interest in accounts ; does not run in first month - as paid in arrears set monthlySaversRate precision ( annualSaversRate% / ( 12 * 100 )) 6 ask households with [ ownTotalSavings > 0 ] [ set saversInterestPayment precision ( ownTotalSavings * monthlySaversRate ) 6 set ownTotalSavings ( ownTotalSavings + saversInterestPayment) ] set totalSaversInterestPayments precision sum [ saversInterestPayment ] of households 0 end ;----------------------- to collect-interest-on-liquid-assets ; banks ; does not run in first month - as paid in arrears set incomeOnLiquidAssets precision ( totalBanksLiquidity * monthlySaversRate ) 0 end ;----------------------------------- to make-deposits ; does not run in first month as initial savings set ; spentLoans are generated by payments in the last round ; households only ask households [ set paymentHistory lput spentLoan paymentHistory ] ask households with [ spentLoan > 0 ] [ set ownTotalSavings ( ownTotalSavings + spentLoan ) set spentLoan 0 ] ask households with [ ownOutstandingBorrowing > 0 ] [ set color red ] ask households with [ ownOutstandingBorrowing = 0 and ownTotalSavings > 0 ] [ set color black ] ask households [ set savingHistory lput ownTotalSavings savingHistory set borrowingHistory lput ownOutstandingBorrowing borrowingHistory ] end ;---------------------------- to make-loans ; banks decide how much to lend ; put aside funds to meet liquidity ratio set totalDepositsAtStartOfMonth precision ( sum [ ownTotalSavings ] of households ) 0 set totalBanksRequiredLiquidity precision (( totalDepositsAtStartOfMonth * targetReserveRatio% ) / 100 ) 0 ; looks at how much lent set totalLendingAtStartOfMonth precision ( sum [ ownOutstandingBorrowing ] of households ) 0 ; takes repayments into account ; calculate amount available for new loans set totalCapital ( sum [ capital ] of banks ) set overallBalanceAtStartOfMonth overallBalanceAtEndOfMonth set newLoanSupply precision ( totalDepositsAtStartOfMonth - totalBanksRequiredLiquidity - totalLendingAtStartOfMonth ; includes spare cash by definition ; + overallBalanceAtStartOfMonth ) 0 if newLoanSupply < 0 [ set newLoanSupply 0 ] ; check against capital adequacy ratio calculated at end of last month - so can't be calculated for first month if month-counter = 1 [ set newLoansAvailable newLoanSupply ] if month-counter > 1 [ ifelse capitalAdequacyRatio% >= targetCapitalAdequacyRatio% [ set newLoansAvailable newLoanSupply ] [ set carConstraintIndicator 1 set maxRWA ( totalCapital + totalRetainedProfit) / ( targetCapitalAdequacyRatio% / 100 ) set maxLendingAllowed maxRWA / ( riskWeightLoan% / 100 ) set newLoansAvailable precision ( maxLendingAllowed - totalLendingAtStartOfMonth ) 0 ] ] ; check if newLoansAvailable enough to make loans if newLoansAvailable < 0 [ set newLoansAvailable 0 set nOfLoans 0 ] ; loanSize depends on type of loan - set under reset-globals procedure if newLoansAvailable < loanSize [ set newLoansAvailable 0 set nOfLoans 0 ] set nOfNewBorrowers "nk" ; rounding if newLoansAvailable > 0 [ set nOfLoans floor ( newLoansAvailable / loanSize ) ] if nOfLoans > 0 [ set newLoansAvailable nOfLoans * loanSize ] ; no lending if nOfLoans = 0 [ set nOfNewBorrowers 0 if monthLoansStop = 0 [ set monthLoansStop month-counter ] ] ; Only one loan each. ; monthlyCosts is set in setup and is same for all ; applies affordability test ifelse affordabilityTest [ ask households with [ ownOutstandingBorrowing = 0 and ( 0.5 * budget ) >= monthlyCost ] [ set potentialBorrower "Yes" ] ] [ ask households with [ ownOutstandingBorrowing = 0 ] [ set potentialBorrower "Yes" ] ] set potentialBorrowers count households with [ potentialBorrower = "Yes" ] if potentialBorrowers = 0 [ set nOfNewBorrowers 0 ] ; number of borrowers determined by supply of loan funds or eligibility if potentialBorrowers != 0 [ ifelse nOfLoans <= potentialBorrowers [ set nOfNewBorrowers nOfLoans ] [ set nOfNewBorrowers potentialBorrowers ] ] ; households take loans ask n-of nOfNewBorrowers households with [ ownOutstandingBorrowing = 0 and potentialBorrower = "Yes"] [ set ownLoan loanSize ; ownLoan is the original loan that does not change set ownOutstandingBorrowing ownLoan ; starts off as the same as ownLoan but is reduced by capital repayments set monthlyRepayment monthlyCost ; monthlyCost fixed in setup - same for all set newLoan "Yes" set color red ] set totalNewLoans sum [ ownLoan ] of households with [ newLoan = "Yes" ] ; banks spare cash is NOT cumulative set banksSpareCash newLoanSupply - totalNewLoans if banksSpareCash < 0 [ set loanError "Yes" ] end ;---------------------------- to spend-loans ask households with [ newLoan = "Yes" ] ; identifies only those becoming borrowers this month; if used ownLoan would include all borrowers [ set seller one-of households ; payments made to anyone, so some loans will in effect be used to repay the borrowings of sellers if offset allowed. ask seller [ set spentLoan [ ownLoan ] of myself ] ] end ;----------------------- to collect-data-at-end-of-month ; households borrow, banks lend ; households save, banks have deposits ; only one bank! ; bank's balance sheet ; assets = liquidity + lending + spare cash + current profit ; liabilities = deposits + capital + retained profit set totalCurrentProfit ( totalBorrowersInterestPayments + incomeOnLiquidAssets - totalSaversInterestPayments - totalBadDebts ) set totalRetainedProfit ( totalRetainedProfit + totalCurrentProfit ) set totalDepositsAtEndOfMonth precision ( sum [ ownTotalSavings ] of households ) 0 set totalCapitalAtEndOfMonth sum [ capital ] of banks set totalLiabilitiesAtEndOfMonth totalDepositsAtEndOfMonth + totalCapitalAtEndOfMonth + totalRetainedProfit set totalLendingAtEndOfMonth precision ( sum [ ownOutstandingBorrowing ] of households ) 0 set totalBanksLiquidity ( totalBanksRequiredLiquidity + banksSpareCash + totalRetainedProfit + totalCapitalAtEndOfMonth ) set totalAssetsAtEndOfMonth totalBanksLiquidity + totalLendingAtEndOfMonth set overallBalanceAtEndOfMonth precision ( totalAssetsAtEndOfMonth - totalLiabilitiesAtEndOfMonth ) 0 set check totalLendingAtEndOfMonth - ( totalLendingAtStartOfMonth + totalNewLoans ) ; nb totalLendingAtStartOfMonth takes repayments into account ; reserve ratio set reserveRatio% precision ( totalBanksLiquidity / totalDepositsAtEndOfMonth * 100 ) 3 ; capital-adequacy-ratio ; risk weight allocated in set-up ask banks [ set riskWeightedExposure ( totalLendingAtEndOfMonth * riskWeightLoan% / 100 ) ] set totalRiskWeightedExposure sum [ riskWeightedExposure ] of banks ifelse totalRiskWeightedExposure > 0 [ set capitalAdequacyRatio% precision ( ( totalCapital + totalRetainedProfit) / totalRiskWeightedExposure * 100 ) 2 if capitalAdequacyRatio% < 0 [set capitalAdequacyRatio% 0 ]] [ set capitalAdequacyRatio% 0 ] ; multipliers ; households hold no cash, so the money supply = deposits and the bank deposit and money multipliers are the same set bankDepositMultiplier totalDepositsAtEndOfMonth / totalInitialDeposits ; macro set totalExpenditure precision sum [ ownExpenditureThisMonth ] of households 0 ; collect data if month-counter = 12 [ collect-data-12 ] if month-counter = 60 [ collect-data-60 ] if month-counter = 120 [ collect-data-120 ] ; plots if run-counter = 1 [ do-plots ] end ;------------------------------------------------------------------------------------------------------------------------------- ; RESULTS ;------------------------------------------------------------------------------------------------------------------------------- to collect-data-12 ; bank metrics set reserveRatio%12 reserveRatio% set capitalAdequacyRatio%12 capitalAdequacyRatio% set bankDepositMultiplier12 bankDepositMultiplier set accumReserveRatio%12 lput reserveRatio%12 accumReserveRatio%12 set accumCapitalAdequacyRatio%12 lput capitalAdequacyRatio%12 accumCapitalAdequacyRatio%12 set accumBankDepositMultiplier12 lput bankDepositMultiplier12 accumBankDepositMultiplier12 set totalLiabilitiesAtEndOfMonth12 totalLiabilitiesAtEndOfMonth set totalAssetsAtEndOfMonth12 totalAssetsAtEndOfMonth set totalRetainedProfit12 totalRetainedProfit set totalLendingAtEndOfMonth12 totalLendingAtEndOfMonth set accumTotalLiabilitiesAtEndOfMonth12 lput totalLiabilitiesAtEndOfMonth12 accumTotalLiabilitiesAtEndOfMonth12 set accumTotalAssetsAtEndOfMonth12 lput totalAssetsAtEndOfMonth12 accumTotalAssetsAtEndOfMonth12 set accumTotalRetainedProfit12 lput totalRetainedProfit12 accumTotalRetainedProfit12 set accumTotalLendingAtEndOfMonth12 lput totalLendingAtEndOfMonth12 accumTotalLendingAtEndOfMonth12 ; savers defined as having savings greater than 10K set borrowers12 count households with [ ownOutstandingBorrowing > 0 ] set savers12 count households with [ ownTotalSavings >= 10 ] set potentialBorrowers12 count households with [ potentialBorrower = "Yes" ] set accumBorrowers12 lput borrowers12 accumBorrowers12 set accumSavers12 lput savers12 accumSavers12 set accumPotentialBorrowers12 lput potentialBorrowers12 accumPotentialBorrowers12 set avSavings12 precision mean [ ownTotalSavings ] of households with [ ownTotalSavings >= 10 ] 1 set accumAvSavings12 lput avSavings12 accumAvSavings12 ; supply of loans set totalNewLoans12 totalNewLoans set accumTotalNewLoans12 lput totalNewLoans12 accumTotalNewLoans12 ; expenditure set totalExpenditure12 totalExpenditure set totalRepayments12 totalRepayments set accumTotalExpenditure12 lput totalExpenditure12 accumTotalExpenditure12 set accumTotalRepayments12 lput totalRepayments12 accumTotalRepayments12 end to collect-data-60 ; bank metrics set reserveRatio%60 reserveRatio% set capitalAdequacyRatio%60 capitalAdequacyRatio% set bankDepositMultiplier60 bankDepositMultiplier set accumReserveRatio%60 lput reserveRatio%60 accumReserveRatio%60 set accumCapitalAdequacyRatio%60 lput capitalAdequacyRatio%60 accumCapitalAdequacyRatio%60 set accumBankDepositMultiplier60 lput bankDepositMultiplier60 accumBankDepositMultiplier60 set totalLiabilitiesAtEndOfMonth60 totalLiabilitiesAtEndOfMonth set totalAssetsAtEndOfMonth60 totalAssetsAtEndOfMonth set totalRetainedProfit60 totalRetainedProfit set totalLendingAtEndOfMonth60 totalLendingAtEndOfMonth set accumTotalLiabilitiesAtEndOfMonth60 lput totalLiabilitiesAtEndOfMonth60 accumTotalLiabilitiesAtEndOfMonth60 set accumTotalAssetsAtEndOfMonth60 lput totalAssetsAtEndOfMonth60 accumTotalAssetsAtEndOfMonth60 set accumTotalRetainedProfit60 lput totalRetainedProfit60 accumTotalRetainedProfit60 set accumTotalLendingAtEndOfMonth60 lput totalLendingAtEndOfMonth60 accumTotalLendingAtEndOfMonth60 ; savers defined as having savings greater than 10K set borrowers60 count households with [ ownOutstandingBorrowing > 0 ] set savers60 count households with [ ownTotalSavings >= 10 ] set potentialBorrowers60 count households with [ potentialBorrower = "Yes" ] set accumBorrowers60 lput borrowers60 accumBorrowers60 set accumSavers60 lput savers60 accumSavers60 set accumPotentialBorrowers60 lput potentialBorrowers60 accumPotentialBorrowers60 set avSavings60 precision mean [ ownTotalSavings ] of households with [ ownTotalSavings >= 10 ] 1 set accumAvSavings60 lput avSavings60 accumAvSavings60 ; supply of loans set totalNewLoans60 totalNewLoans set accumTotalNewLoans60 lput totalNewLoans60 accumTotalNewLoans60 ; expenditure set totalExpenditure60 totalExpenditure set totalRepayments60 totalRepayments set accumTotalExpenditure60 lput totalExpenditure60 accumTotalExpenditure60 set accumTotalRepayments60 lput totalRepayments60 accumTotalRepayments60 end to collect-data-120 ; bank metrics set reserveRatio%120 reserveRatio% set capitalAdequacyRatio%120 capitalAdequacyRatio% set bankDepositMultiplier120 bankDepositMultiplier set accumReserveRatio%120 lput reserveRatio%120 accumReserveRatio%120 set accumCapitalAdequacyRatio%120 lput capitalAdequacyRatio%120 accumCapitalAdequacyRatio%120 set accumBankDepositMultiplier120 lput bankDepositMultiplier120 accumBankDepositMultiplier120 set totalLiabilitiesAtEndOfMonth120 totalLiabilitiesAtEndOfMonth set totalAssetsAtEndOfMonth120 totalAssetsAtEndOfMonth set totalRetainedProfit120 totalRetainedProfit set totalLendingAtEndOfMonth120 totalLendingAtEndOfMonth set accumTotalLiabilitiesAtEndOfMonth120 lput totalLiabilitiesAtEndOfMonth120 accumTotalLiabilitiesAtEndOfMonth120 set accumTotalAssetsAtEndOfMonth120 lput totalAssetsAtEndOfMonth120 accumTotalAssetsAtEndOfMonth120 set accumTotalRetainedProfit120 lput totalRetainedProfit120 accumTotalRetainedProfit120 set accumTotalLendingAtEndOfMonth120 lput totalLendingAtEndOfMonth120 accumTotalLendingAtEndOfMonth120 ; savers defined as having savings greater than 10K set borrowers120 count households with [ ownOutstandingBorrowing > 0 ] set savers120 count households with [ ownTotalSavings >= 10 ] set potentialBorrowers120 count households with [ potentialBorrower = "Yes" ] set accumBorrowers120 lput borrowers120 accumBorrowers120 set accumSavers120 lput savers120 accumSavers120 set accumPotentialBorrowers120 lput potentialBorrowers120 accumPotentialBorrowers120 set avSavings120 precision mean [ ownTotalSavings ] of households with [ ownTotalSavings >= 10 ] 1 set accumAvSavings120 lput avSavings120 accumAvSavings120 ; supply of loans set totalNewLoans120 totalNewLoans set accumTotalNewLoans120 lput totalNewLoans120 accumTotalNewLoans120 ; expenditure set totalExpenditure120 totalExpenditure set totalRepayments120 totalRepayments set accumTotalExpenditure120 lput totalExpenditure120 accumTotalExpenditure120 set accumTotalRepayments120 lput totalRepayments120 accumTotalRepayments120 end ;--------------- to collect-data-at-end file-open (word "Banking-"description".csv" ) file-print " " file-print ( word "Results over " number-of-runs " runs") file-print " " file-print " " file-print "Bank metrics" file-print "Months Mean Reserve Ratio % (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumReserveRatio%12 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumReserveRatio%12 ) 1 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumReserveRatio%60 ) 1 ) if number-of-runs > 1 [ file-type ( word " ( " precision ( standard-deviation accumReserveRatio%60 ) 1 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 120 [ file-type ( "120 " ) file-type (precision ( mean accumReserveRatio%120 ) 1 ) if number-of-runs > 1 [ file-type (word "( " precision ( standard-deviation accumReserveRatio%120 ) 1 ) file-type ( word " )")] ] file-print " " file-print " " file-print "Months Mean Cap Ad Ratio % (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type ( precision ( mean accumCapitalAdequacyRatio%12 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumCapitalAdequacyRatio%12 ) 1 ) file-type ( word " )") ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumCapitalAdequacyRatio%60 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumCapitalAdequacyRatio%60 ) 1 ) file-type ( word " )") ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type (precision ( mean accumCapitalAdequacyRatio%120 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumCapitalAdequacyRatio%120 ) 1 ) file-type ( word " )") ] ] file-print " " file-print " " file-print "Months Mean Bank Deposit Multiplier" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumBankDepositMultiplier12 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumBankDepositMultiplier12 ) 1 ) file-type ( word " )") ] ] if month-counter >= 60 [ file-print " " file-type (word "60 " ) file-type ( precision ( mean accumBankDepositMultiplier60 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumBankDepositMultiplier60 ) 1 ) file-type ( word " )") ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type ( precision ( mean accumBankDepositMultiplier120 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumBankDepositMultiplier120 ) 1 ) file-type ( word " )") ] ] file-print " " file-print " " file-print "Bank balance sheet" file-print "Months Mean Liabilities (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumTotalLiabilitiesAtEndOfMonth12 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalLiabilitiesAtEndOfMonth12 ) 0 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumTotalLiabilitiesAtEndOfMonth60 ) 0 ) if number-of-runs > 1 [ file-type ( word " ( " precision ( standard-deviation accumTotalLiabilitiesAtEndOfMonth60 ) 0 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 120 [ file-type ( "120 " ) file-type (precision ( mean accumTotalLiabilitiesAtEndOfMonth120 ) 0 ) if number-of-runs > 1 [ file-type (word "( " precision ( standard-deviation accumTotalLiabilitiesAtEndOfMonth120 ) 0 ) file-type ( word " )")] ] file-print " " file-print " " file-print "Months Mean Assets (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type ( precision ( mean accumTotalAssetsAtEndOfMonth12 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalAssetsAtEndOfMonth12 ) 0 ) file-type ( word " )") ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumTotalAssetsAtEndOfMonth60 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalAssetsAtEndOfMonth60 ) 0 ) file-type ( word " )") ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type (precision ( mean accumTotalAssetsAtEndOfMonth120 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalAssetsAtEndOfMonth120 ) 0 ) file-type ( word " )") ] ] file-print " " file-print " " file-print "Months Retained profit (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumTotalRetainedProfit12 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalRetainedProfit12 ) 0 ) file-type ( word " )") ] ] if month-counter >= 60 [ file-print " " file-type (word "60 " ) file-type ( precision ( mean accumTotalRetainedProfit60 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalRetainedProfit60 ) 0 ) file-type ( word " )") ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type ( precision ( mean accumTotalRetainedProfit120 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalRetainedProfit120 ) 0 ) file-type ( word " )") ] ] file-print " " file-print " " file-print "Months Total lending (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumTotalLendingAtEndOfMonth12 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalLendingAtEndOfMonth12 ) 0 ) file-type ( word " )") ] ] if month-counter >= 60 [ file-print " " file-type (word "60 " ) file-type ( precision ( mean accumTotalLendingAtEndOfMonth60 ) 0 ) if number-of-runs > 1 [ file-type (word "(" precision ( standard-deviation accumTotalLendingAtEndOfMonth60 ) 0 ) file-type ( word " )") ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type ( precision ( mean accumTotalLendingAtEndOfMonth120 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalLendingAtEndOfMonth120 ) 0 ) file-type ( word " )") ] ] file-print " " file-print " " file-print "Total new money loaned in month" file-print "Months Mean" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumTotalNewLoans12 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalNewLoans12 ) 0 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumTotalNewLoans60 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalNewLoans60 ) 0 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type (precision ( mean accumTotalNewLoans120 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalNewLoans120 ) 0 ) file-type ( word " )" ) ] ] file-print " " file-print " " file-print "Macro metrics" file-print "Months Mean total expenditure (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumTotalExpenditure12 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalExpenditure12 ) 0 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumTotalExpenditure60 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalExpenditure60 ) 0 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type (precision ( mean accumTotalExpenditure120 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalExpenditure120 ) 0 ) file-type ( word " )" ) ] ] file-print " " file-print " " file-print "Months Mean total repayments (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumTotalRepayments12 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalRepayments12 ) 0 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumTotalRepayments60 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalRepayments60 ) 0 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type ( precision ( mean accumTotalRepayments120 ) 0 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumTotalRepayments120 ) 0 ) file-type ( word " )" ) ] ] ; savers and borroowers file-print " " file-print " " file-print "Savers and borrowers" file-print "Months Mean no. of borrowers (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type ( precision ( mean accumBorrowers12 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumBorrowers12 ) 1 ) file-type ( word " )" )] ] if month-counter >= 60 [ file-print " " file-type (word "60 " ) file-type (precision ( mean accumBorrowers60 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumBorrowers60 ) 1 ) file-type ( word " )" )] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type (precision ( mean accumBorrowers120 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumBorrowers120 ) 1 ) file-type ( word " )" ) ] ] file-print " " file-print " " file-print "Months Mean no. of savers (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumSavers12 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumSavers12 ) 1 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type ( precision ( mean accumSavers60 ) 1 ) if number-of-runs > 1 [ file-type (word " (" precision ( standard-deviation accumSavers60 ) 1 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type (precision ( mean accumSavers120 ) 1 ) if number-of-runs > 1 [ file-type (word " (" precision ( standard-deviation accumSavers120 ) 1 ) file-type ( word " )" ) ] ] file-print " " file-print " " file-print "Months Mean no. of potential borrowers (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumPotentialBorrowers12 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumPotentialBorrowers12 ) 1 ) file-type ( word " )" )] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumPotentialBorrowers60 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumPotentialBorrowers60 ) 1 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type (precision ( mean accumPotentialBorrowers120 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumPotentialBorrowers120 ) 1 ) file-type ( word " )" ) ] ] ; mean savings file-print "Months Mean savings of savers (sd)" if month-counter >= 12 [ file-type (word "12 " ) file-type (precision ( mean accumAvSavings12 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumAvSavings12 ) 1 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 60 [ file-type (word "60 " ) file-type (precision ( mean accumAvSavings60 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumAvSavings60 ) 1 ) file-type ( word " )" ) ] file-print " " ] if month-counter >= 120 [ file-type (word "120 " ) file-type (precision ( mean accumAvSavings120 ) 1 ) if number-of-runs > 1 [ file-type (word " ( " precision ( standard-deviation accumAvSavings120 ) 1 ) file-type ( word " )" ) ] ] export-all-plots (word "Banking-"description".csv" ) file-close end ;---------------------------- to do-plots set-current-plot "Bank balance sheet" set-current-plot-pen "Capital" plotxy month-counter totalCapitalAtEndOfMonth / 1000 set-current-plot-pen "Deposits" plotxy month-counter totalDepositsAtEndOfMonth / 1000 set-current-plot-pen "Profits" plotxy month-counter totalRetainedProfit / 1000 set-current-plot-pen "Liabilities" plotxy month-counter totalLiabilitiesAtEndOfMonth / 1000 set-current-plot-pen "Liquid" plotxy month-counter totalBanksLiquidity / 1000 set-current-plot-pen "Lending" plotxy month-counter totalLendingAtEndOfMonth / 1000 set-current-plot-pen "Assets" plotxy month-counter totalAssetsAtEndOfMonth / 1000 set-current-plot-pen "Balance" plotxy month-counter overallBalanceAtEndOfMonth / 1000 set-current-plot "RWE" plotxy month-counter totalRiskWeightedExposure set-current-plot "Bank Multiplier" plotxy month-counter bankDepositMultiplier set-current-plot "Ratios" set-current-plot-pen "Cap Ad" plotxy month-counter capitalAdequacyRatio% set-current-plot-pen "Reserve" plotxy month-counter reserveRatio% set-current-plot "Repayments etc" set-current-plot-pen "Cap" plotxy month-counter totalCapitalRepayments set-current-plot-pen "Int" plotxy month-counter totalBorrowersInterestPayments set-current-plot-pen "Total" plotxy month-counter totalRepayments set-current-plot "Income and Profits" set-current-plot-pen "Borrowers" plotxy month-counter totalBorrowersInterestPayments set-current-plot-pen "Liquid" plotxy month-counter incomeOnLiquidAssets set-current-plot-pen "Savers" plotxy month-counter totalSaversInterestPayments set-current-plot-pen "Bad" plotxy month-counter totalBadDebts set-current-plot-pen "Profits" plotxy month-counter totalCurrentProfit set-current-plot "New loan determinants" set-current-plot-pen "Deposits" plotxy month-counter totalDepositsAtStartOfMonth set-current-plot-pen "Liquid" plotxy month-counter totalBanksRequiredLiquidity set-current-plot-pen "Lending" plotxy month-counter totalLendingAtStartOfMonth set-current-plot "New loans" set-current-plot-pen "Supply" plotxy month-counter newLoanSupply set-current-plot-pen "Made" plotxy month-counter totalNewLoans set-current-plot "Borrowers and savers" set-current-plot-pen "Borrowers" plotxy month-counter count households with [ ownOutstandingBorrowing > 0 ] set-current-plot-pen "Savers" plotxy month-counter count households with [ ownTotalSavings >= 10 ] set-current-plot-pen "Pot Borrow" plotxy month-counter count households with [ potentialBorrower = "Yes" ] set-current-plot-pen "Def" plotxy month-counter count households with [ defaulter ="Yes" ] set-current-plot "Av borrowings and savings" set-current-plot-pen "Loans" plotxy month-counter loanSize set-current-plot-pen "Borrowings" if count households with [ ownOutstandingBorrowing > 0 ] > 0 [ plotxy month-counter mean [ ownOutstandingBorrowing ] of households with [ ownOutstandingBorrowing > 0 ] ] set-current-plot-pen "Savings" if count households with [ ownTotalSavings >= 10 ] >= 10 [ plotxy month-counter mean [ ownTotalSavings ] of households with [ ownTotalSavings >= 10 ] ] set-current-plot "Macro" set-current-plot-pen "Expdt" plotxy month-counter totalExpenditure set-current-plot-pen "Repay" plotxy month-counter totalRepayments set-current-plot "CarConstraintIndicator" plotxy month-counter carConstraintIndicator end ;__________________________________________________________________________________________________________________________________________ ;__________________________________________________________________________________________________________________________________________ @#$#@#$#@ GRAPHICS-WINDOW 1540 14 2261 756 353 353 1.008 1 10 1 1 1 0 1 1 1 -353 353 -353 353 0 0 1 ticks 30.0 BUTTON 3 10 67 43 Setup setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 81 10 144 43 Go Go NIL 1 T OBSERVER NIL NIL NIL NIL 1 TEXTBOX 1547 385 1812 477 Black = savers (no borrowing)\nRed = borrowers\nBlue = neither\nGreen = bank\n 12 0.0 1 MONITOR 140 128 235 173 NIL month-counter 0 1 11 CHOOSER 11 179 129 224 number-of-runs number-of-runs 1 2 4 10 30 50 2 MONITOR 138 181 230 226 NIL run-counter 0 1 11 CHOOSER 9 127 123 172 number-of-months number-of-months 1 2 3 4 12 36 60 120 240 300 7 PLOT 14 510 343 736 Borrowers and savers Month Number 0.0 120.0 0.0 1000.0 true true "" "" PENS "borrowers" 1.0 0 -2674135 true "" "" "savers" 1.0 0 -16777216 true "" "" "pot borrow" 1.0 0 -13345367 true "" "" "def" 1.0 0 -13840069 true "" "" PLOT 838 10 1226 310 Bank balance sheet Month Money (million) 0.0 120.0 0.0 100.0 true true "" "" PENS "Deposits" 1.0 0 -8630108 true "" "" "Capital" 1.0 0 -16777216 true "" "" "Profits" 1.0 0 -2064490 true "" "" "Liabilities" 1.0 0 -5825686 true "" "" "Liquid" 1.0 0 -13791810 true "" "" "Lending" 1.0 0 -13840069 true "" "" "Assets" 1.0 0 -6459832 true "" "" "Balance" 1.0 0 -2674135 true "" "" INPUTBOX 162 10 335 70 description test 1 0 String PLOT 538 331 817 500 Bank Multiplier Month NIL 0.0 120.0 0.0 10.0 true false "" "" PENS "Bank" 1.0 0 -16777216 true "" "" MONITOR 1357 208 1526 253 NIL totalDepositsAtEndOfMonth 0 1 11 MONITOR 1357 254 1536 299 NIL totalLendingAtEndOfMonth 0 1 11 MONITOR 1351 16 1521 61 NIL totalInitialDeposits 0 1 11 MONITOR 1356 153 1458 198 NIL newLoanSupply 0 1 11 MONITOR 1352 60 1526 105 NIL totalDepositsAtStartOfMonth 0 1 11 MONITOR 1350 106 1534 151 NIL totalLendingAtStartOfMonth 0 1 11 PLOT 360 511 724 731 Av borrowings and savings Month Money 0.0 120.0 0.0 100.0 true true "" "" PENS "Loans" 1.0 0 -8630108 true "" "" "Borrowings" 1.0 0 -2674135 true "" "" "Savings" 1.0 0 -13345367 true "" "" PLOT 824 752 1187 983 New loans Months Money (thous) 0.0 120.0 0.0 1000.0 true true "" "" PENS "supply" 1.0 0 -13345367 true "" "" "made" 1.0 0 -13840069 true "" "" MONITOR 1358 371 1415 416 NIL check 0 1 11 CHOOSER 344 12 507 57 loanType loanType "mortgages" "consumer loans" 0 PLOT 539 95 813 323 Ratios Month % 0.0 120.0 0.0 20.0 true true "" "" PENS "Cap Ad" 1.0 0 -16777216 true "" "" "Reserve" 1.0 0 -13345367 true "" "" PLOT 825 993 1223 1189 RWE Month Money (million) 0.0 120.0 0.0 10.0 true false "" "" PENS "RWE" 1.0 0 -16777216 true "" "" CHOOSER 520 15 658 60 equityCapital equityCapital 1000 10000 0 CHOOSER 349 66 509 111 targetReserveRatio% targetReserveRatio% 0 10 1 CHOOSER 348 117 508 162 targetCapitalAdequacyRatio% targetCapitalAdequacyRatio% 0 10 1 PLOT 396 1000 797 1203 Macro Month Money (millions) 0.0 120.0 0.0 100.0 true true "" "" PENS "Expdt" 1.0 0 -16777216 true "" "" "Repay" 1.0 0 -2674135 true "" "" MONITOR 14 323 143 368 mean savings of savers mean [ ownTotalSavings ] of households with [ ownTotalSavings > 0 ] 0 1 11 SWITCH 349 172 496 205 affordabilityTest affordabilityTest 0 1 -1000 SWITCH 348 251 451 284 shock shock 1 1 -1000 PLOT 19 1001 381 1209 Repayments etc Month Money (thous) 0.0 120.0 0.0 100.0 true true "" "" PENS "Cap" 1.0 0 -13345367 true "" "" "Int" 1.0 0 -13840069 true "" "" "Total" 1.0 0 -2674135 true "" "" PLOT 838 329 1160 501 CarConstraintIndicator NIL NIL 0.0 120.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "" TEXTBOX 271 130 335 182 Savers have at least 10K of savings 11 0.0 1 SLIDER 13 243 185 276 annualLoanRate% annualLoanRate% 0 10 5 1 1 NIL HORIZONTAL SLIDER 12 279 184 312 annualSaversRate% annualSaversRate% 0 10 2 1 1 NIL HORIZONTAL CHOOSER 9 76 147 121 nOfHouseholds nOfHouseholds 1000 5000 10000 1 MONITOR 350 396 446 441 N of defaulters count households with [ defaulter = \"Yes\" ] 0 1 11 CHOOSER 168 72 306 117 nOfSavers nOfSavers 100 1000 0 MONITOR 1358 320 1422 365 NIL loanError 0 1 11 PLOT 20 756 376 991 Income and Profits Month Money (thous) 0.0 120.0 0.0 10.0 true true "" "" PENS "Savers" 1.0 0 -16777216 true "" "" "Borrowers" 1.0 0 -2674135 true "" "" "Liquid" 1.0 0 -8630108 true "" "" "Bad" 1.0 0 -7500403 true "" "" "Profits" 1.0 0 -955883 true "" "" CHOOSER 348 292 486 337 shock-month shock-month 0 12 30 0 CHOOSER 350 343 488 388 defaulters% defaulters% 0 1 2 5 10 0 PLOT 392 755 795 991 New loan determinants NIL NIL 0.0 120.0 0.0 1000.0 true true "" "" PENS "Deposits" 1.0 0 -5825686 true "" "" "Liquid" 1.0 0 -11221820 true "" "" "Lending" 1.0 0 -13840069 true "" "" TEXTBOX 578 67 804 105 PLOTS FOR FIRST RUN ONLY 15 0.0 1 @#$#@#$#@ ## WHAT IS IT? A very simple model of the banking system designed to examine the impact of a once-off tranche of lending. ## HOW IT WORKS There is one bank and either 1 000, 5 000 or 10 000 households. Each household is allocated a monthly budget designed to produce a Gini coefficient of about 0.3 and an average of £1 000 (on the basis of the method used in Chapter 3). The households use it to repay their loans and interest or spend this money. Only loan repayments and interest on loans go through the bank. (This assumption is justified in that this is money that is circulating by being earned and spent and being shifted from one bank account to another.) The number of households which are initially savers are set by the modeller. As each household is assumed to have £10 000 of savings deposited with the bank, this sets the initial total deposits. Interest can be charged on loans and paid on savings. Interest can generate profit for the bank. Nothing is done with this: it is held as retained profit. If savers receive interest, this is added to their savings The bank decides how much to lend each month while trying to stay within the target reserve and capital adequacy ratios, which are set by the modeller (and can be zero). Reserve ratio = Liquid assets / Deposits Capital adequacy ratio = ( Capital + Retained profit ) / Risk weighted assets These ratios are calculated at the end of the month. So the bank is making its decsion of what the position was at the end of the last month: this means that it may breach the targets. As it cannot recall the loans the next month, it may take some time for the bank to return to the target ratios. The bank can lend as much as it is able i.e. everyone who can afford a loan and does not already have one is a potential borrower. The affordability test is that the debt repayment must not exceed half of the household's budget. The model can be run with the test switched on or off. Each household can have only one loan. If the bank cannot lend all the money it has available without breaching the target ratios, it has to keep the funds liquid and will earn on the rate paid to savers. (This is like having to deposit money with the Bank of England at the 'bank rate'.) All loans are either mortgages or consumer loans: Mortgage loans are of £100 000 over 25 years. Consumer loans are of £5 000 over 3 years. Households obtaining a loan spend it immediately by transferring it to another household chosen at random. This simulates the end of a house purchase chain or a purchase of a second-hand car. The household receving the payment saves it, thereby increasing the amount deposited with the bank. Households with loans make monthly repayments of equal amounts throughout the period of the loan. The shock to the system is default by a chosen percentage of borrowers in a chosen month. The bank's balance sheet is defined as: assets = liquidity + lending + spare cash + current profit liabilities = deposits + capital + retained profit The Bank Deposit Multiplier measures the growth in deposits. These two ratios, the balance sheet and the multiplier are calculated at the end of each month in the 'collect-data-at-end-of-month' subroutine. Detailed definitions are given below. The proportion of total expenditure taken up by debt repayments is also calculated and the number of borrowers and savers counted. ###Detailed definitions _Reserve ratio_ reserveRatio% = ( totalBanksLiquidity / totalDepositsAtEndOfMonth * 100 ) where totalBanksLiquidity = ( totalBanksRequiredLiquidity + banksSpareCash +totalRetainedProfit + totalCapitalAtEndOfMonth ) where totalBanksRequiredLiquidity = totalDepositsAtStartOfMonth * targetReserveRatio% banksSpareCash is the difference between what the bank has available to end and what it can lean i.e. ( newLoanSupply - totalNewLoans ) totalRetainedProfit is the cumulated totalCurrentProfit where the totalCurrentProfit in any month = ( totalBorrowersInterestPayments + incomeOnLiquidAssets - totalSaversInterestPayments - totalBadDebts ) totalCapitalAtEndOfMonth is the amount of capital the bank has (which does not change) _Capital Adequacy Ratio_ capitalAdequacyRatio% = ( totalCapital + totalRetainedProfit) / totalRiskWeightedExposure where totalRiskWeightedExposure = totalLendingAtEndOfMonth * riskWeightLoan% and weight = 0 for liquid, 50% for mortgages and 100% for consumer loans _Balance sheet_ overallBalanceAtEndOfMonth = totalAssetsAtEndOfMonth - totalLiabilitiesAtEndOfMonth where totalAssetsAtEndOfMonth = totalBanksLiquidity + totalLendingAtEndOfMonth (as defined above) totalLiabilitiesAtEndOfMonth totalDepositsAtEndOfMonth + totalCapitalAtEndOfMonth + totalRetainedProfit _Bank deposit multiplier_ bankDepositMultiplier totalDepositsAtEndOfMonth / totalInitialDeposits ### Outputs Plots are done for the first run. Full results are summarised in a csv file. ## HOW TO USE IT Set the number of households. For quick runs, use 1 000. But using less than 10 000 households risks running out of borrowers, esepcially for the small consumer loans. Set the number of savers. This will determine the size of the bank's initial deposits: each saver has £10 000 deposited. Set the bank's capital. Set the reserve ratio and capital adequacy targets: these ratios can be zero. Choose whether the affordability test used or not. Choose whether a shock is required, and if so, its size and timing. Set the interest rates for savers and borrowers: these rates can be zero. Choose a run name and set the number of rounds and runs required. ## THINGS TO TRY Increase the initial deposits at the bank by increasing the number of savers. Increase the bank's equity capital. Change the target ratios. Explore the effect of raising interest rates. Explore the impact of a shock to the system. ## CREDITS AND REFERENCES Runs on NetLogo 5.2. For more information, see Hamill, L. & Gilbert, N. (2016) Agent-based Modelling in Economics. Wiley: Chapter 9. To refer to this model: Hamill, L. & Gilbert, N. (2016) Banking model. @#$#@#$#@ 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 sheep false 0 Rectangle -7500403 true true 151 225 180 285 Rectangle -7500403 true true 47 225 75 285 Rectangle -7500403 true true 15 75 210 225 Circle -7500403 true true 135 75 150 Circle -16777216 true false 165 76 116 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 5.2.0 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ 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 @#$#@#$#@