# Income distribution inequality and credit risk

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

## WHAT IS IT?

This is a simple model to explore the effect of income distribution on the transmission of shocks and the evolution of non-performing loans and household expenditure (as a representative macroeconomic variable) under normal and adverse economic conditions.

## HOW IT WORKS

### Agents

The model has one type of agent named *household*

#### Properties

Households have the following properties:

*shape*is fixed to be*person*.*color*assumes a different value according to the loan-servicing status of the Household.*blue*the Household doesn't have a loan.*green*the Household has a loan and services it from its budget.*orange*the Household has a loan and services it from its deposits.*red*the Household does not service its loan.*grey*the Household does not have a loan nor can meet its basic needs. Typically this category is very small.

*budget*is the monthly income a Household receives.*has-loan?*is True when the Household has a loan, False otherwise.*has-deposits?*is True when the Household has deposits, false otherwise.*deposit-amount*keeps record of the deposits a Household owns.*amount-withdrawn*keeps record of the deposit amount withdrawn from a Household.*amount-needed*denotes the extra amount (if the budget alone is not enough) a Household needs to meet either its basic needs or its loan payments.*available-this-month*is the available money for spending each month. At the beggining of each month has the value of*budget*and it is reduced as the Household spends it for basic needs and/or loan payments.*expenditure-this-month*keeps record of the current month expenditure of each Household*monthly-loan-payment*is the calculated monthly loan payment for each Household. It depends on the size, the interest rate and the duration (term) of the loan.*monthly-loan-rate*is the (monthly) loan interest rate.*capital-repayment*keeps track of the capital repayments of each Household.*borrower-interest-payment*keeps track of the interest repayments of each Household.*outstanding-borrowing*is the amount of loans each Household has.*defaulter?*is True when the Household doesn't service its loan, false otherwise.

#### Actions

Households can take the following actions during the simulation:

- Spend money to meet their basic needs. This money can come either from their
*budget*, from their deposits or both. - Deposit any remaining money (after they've met all their obligations) into their savings account.
- Collect interest on their deposits. For this simulation, the annual savings interest rate is set to 1.5%.
- Spend any remaining money (after they've met all their obligations) at the end of the month.
- Ask for a loan. Each Household can have one loan at a time. There are two types of loans based on their size (which is randomly decided by the requesting Household and is between 5000 and 25000 currency units):
- Loans less than or equal to 10000 currency units. Their duration (also known as "term") is 5 years (60 months) and their annual interest rate is 5%.
- Loans greater than 10000 currency units. Their duration is 10 years (120 months) and their annual interest rate is 3%.

- Pay a loan. This action consists of repaying a loan's interest and capital by using any funds available (
*budget*and/or deposits). - Withdraw from deposits. This action is taken either when a Household cannot meet any of its needs (basic or loan paymennt) with its budget only, or when it wants to spend some amount from its savings (eg. for some luxury buys).

### Environment

The environment consists of the patches and it reflects the overall "economic conditions sentiment" experienced by the Households. The environment affects Househods in their decisions to spend a proportion of their deposits (simulating some luxury buys etc.).

This environment-agent interaction is controled by the color of the patches. It can assume three different values:

- If the economic conditions are benign (
is set to*scenario**normal*) the patches are white. - If the economic conditions are mildly adverse (
is set to*scenario**mild shock*) the patches are orange-ish. - If the economic conditions are severely deteriorated (
is set to*scenario**severe shock*) the patches are red-ish.

### Order of events

#### Initialization (SETUP)

- Every Household property is initialized to zero or to false if it is boolean except for the
*budget*. - Budgets are randomly assigned to each Household according to the selected distribution (
*uniform*,*normal*,*exponential*) following Hamill & Gilbert (2016). The mean and minimum values are approximately the same and are 1000 and 350 currency units respectively. - A minimum expenditure is set to 80% of the minimum
*budget*to simulate the minimum amount that a Household will need to meet its basic needs. Notice that this value remains fixed and does not change under the various scenarios. - The reserve ratio is set to 10%. Therefore, (1 - reserve ratio) times the deposits is the available amount of money for borrowing. For more information on the reserve ratio see the respective Wikipedia lemma on [reserve requirement] (https://en.wikipedia.org/wiki/Reserve_requirement).
- All patches are set to be initially white. Thus, their color will change after the implementation of a given shock and remain changed for as long as the shock lasts (here until the end of the simulation).

#### Execution (GO)

The simulation starts by checking which ** scenario** is selected and runs for

**+ 36 ticks. Assuming that each tick corresponds to one month, the 3 year duration of the simulation emulates the typical time-frame used for bank stress testing exercises (Schuermann, 2014). The following scenarios are implemented:**

*shock-t*- In the
*normal*scenario no shocks are implemented and it can be used as a baseline for comparison with the other scenarios. - In the
*mild shock*scenario, the*budget*of every Household decreases by 0.2% each month or by approximately 2.4% per year. In addition, unemployment (randomly choosing Households and setting their*budget*= 0) rises by 2.4% per year. - The
*severe shock*scenario reflects the 2010 sovereign debt crisis experienced in Greece (based on [Eurostat] (http://ec.europa.eu/eurostat/data/database) data). In this case*budget*decreases by 0.5% each month or by approximately 5.8% per year and unemployment increases by approximately 5% per year.

Next, each Household takes the following actions:

- Spend on basic needs
1.1 If the
*budget*is greater than expenditure for basic needs, then spend from it. 1.2 Else, if*budget*is less than minimum expenditure and there are enough deposits, withdraw from deposits. 1.3 Else, if there are no sufficient deposits to meet basic needs, mark this Household as inactive. - Collect interest on deposits, if any
- Repay existing loan
3.1 If
*budget*exceeds loan payment then repay loan. 3.2 Else, if budget is less than monthly loan payment and there are enough deposits, withdraw from deposits. 3.3 If the needed funds are not available, declare Household as a defaulter. - Ask for a new loan (if it doesn't have one nor is a defaulter) 4.1 Flip a coin to whether or not ask for a loan and proceed accordingly.
- Decide action with remaining budget
5.1 Flip a coin to decide whether to spend or deposit the remaining
*budget*, if any, and proceed accordingly. - Spend some of the deposits (thus simulating e.g. some luxury buys etc.) 6.1 If the conditions are normal (patch color is white), flip a coin to decide whether or not to spend some deposits and if so, randomly choose an amount up to 30% of the deposits. 6.2 If the conditions are adverse (patch color is orange or red) flip a coin to decide whether or not to spend some deposits and if so, randomly choose an amount up to 10% of the deposits.
- Finally, if a Household has repaid its loan, set all related properties to zero or false.

## HOW TO USE IT

### Inputs

The modeller is required to provide the following inputs:

- Set the number of households using the slider
.*num-households* - Select the desired income distribution from the chooser
. The available options are*income-distribution**uniform*,*normal*,*exponential*and*gamma*. - Select the scenario from the chooser
. The available options are*scenario**normal*,*mild shock*and*severe shock*. - Set the time when the shock will begin by typing an integer in the input box
. Remember the following: a) The shock will be applied from the moment specified until the end of the simulation, 36 ticks later; b) Even when the*shock-t**normal*scenario is selected (meaning that there is no shock applied) theneeds to be specified in order for the simulation to terminate. This way a standard simulation time for each scenario is ensured, thus facilitating comparison among them.*shock-t*

After the previous core settings, there is the option to switch on or off the ** affordability-test** and set its value using the slider

**.**

*budget-payment-ratio*- The switch
(de)activates a check to be applied before granting a loan. The check consists of testing whether or not the monthly loan repayment plus the minimum monthly expenditure is less or equal to*affordability-test*times the monthly budget. If activated and this condition holds, then the loan is granted otherwise it is not.*budget-payment-ratio*

After the aforementioned initial settings, the button ** go** starts the simulation.

### Outputs

The plot ** Overall income distribution** and the monitor

**serve mainly as model verification aids. The plot displays the monthly budget distribution of all Households and the monitor shows its average value. They both assist to confirm that the distribution of income has the desired (shape and mean) properties.**

*Average budget*There are two plots with their accompanying monitors related to measuring income inequality and its evolution. The measures used are the [ commonly] ( https://www.equalitytrust.org.uk/notes-statistical-sources-and-methods ) studied ** Gini index** and the

**. A detailed description of the former can be found in the Wikipedia [lemma] ( https://en.wikipedia.org/wiki/Gini_coefficient ), whereas the latter displays how many times richer is the upper 20% of the households compared to the bottom 20% of the households. For the estimation of the Gini index was used the respective part of the code from NetLogo Wealth Distribution model.**

*p80:p20 ratio*The plot ** Total non-performing loans** is visualizing the main output of the model, the total amount of non-performing loans. A vertical line in this and other plots denotes the start of the stress scenario. If the

*normal*scenario is selected, then no vertical line is drawn.

The plot ** # of borrowers (by type)** displays the number of Households according to their loan-servicing status. There are 4 types of borrowers;

*Defaulted*,

*Servicing*,

*Servicing w deposits*,

*No loan*and

*Inactive*. The first and fourth types are the ones who don't service their loan and don't have a loan respectively. The difference between the

*Servicing*and

*Servicing w deposits*is that the former pay their loan using only their budget, while the latter resort to their deposits to meet their payments. The

*Inactive*type is always very small compared to the other types and denotes the Households which do not have a loan nor can meet their basic needs.

The plot ** Income distribution of deafulters** shows the distribution of income of the defaulted Households. It is expected that most defaults will be from zero income (unemployed) Households.

The plot ** Total expenditure** shows the behaviour of the total Household expenditure as an example of a macroeconomic variable and its evolution under normal and stress conditions.

The purpose of the ** Unemployment rate** plot and its accompanying monitor is to provide a verification tool to check that the implementation of the shock is as intended. They both display the number of zero income (unemployed) Households as a percentage of all Households.

## THINGS TO TRY

- Select a given income distribution and examine the impact of different shocks to the total amount of non-performing loans and Household expenditure.
- Select a given shock and examine the impact of different income distributions to the total amount of non-performing loans and Household expenditure.
- Examine the effect that different shocks have to income inequality.
- Perform the previous analyses with the
switched on/off.*affordability-test*

## EXTENDING THE MODEL

The simple model presented here can be extended in various ways such as:

- Implement a recovery period after the end of the shock period. Examine under which conditions and/or how long will it take to return to the pre-shock levels of non-performing loans and/or Household expenditure.
- Create a local "economic conditions sentiment" environment where agents experience the shock in a heterogeneous manner and influence their neighbours accordingly.
- Add a breed for Bank agents so as Households can ask loans from different Banks.
- Create a more detailed banking sector with variables such as Equity, Profits, Liquid Assets, Risk Weighted Assets etc.
- Elaborate on Banks' behaviour by adding capital adequacy, liquidity and other regulatory constraints.

## RELATED MODELS

This model is inspired by and utilizes parts from the Banking model of Hamill, L. & Gilbert, N. (2016). http://cress.soc.surrey.ac.uk/web/sites/default/files/user-uploads/u1/Chapter%209-Banking.nlogo

## CREDITS AND REFERENCES

Built and runs on NetLogo 5.2.

Hamill, L. & Gilbert, N. (2016) Agent-based Modelling in Economics. Wiley: Chapter 9. http://cress.soc.surrey.ac.uk/web/publications/books/agent-based-modelling-economics/more-information

Schuermann, T. (2014). Stress testing banks. International Journal of Forecasting, 30(3), 717-728.

Wilensky, U. (1998). NetLogo Wealth Distribution model. http://ccl.northwestern.edu/netlogo/models/WealthDistribution. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

## COPYRIGHT AND LICENSE

Copyright 2016 Georgios Papadopoulos

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/

## Comments and Questions

;; ---------------------------------------------------------------- ;; Income distribution, inequality and the evolution of credit risk ;; Created by Georgios Papadopoulos as a final project for the Introduction to Agent-Based Modeling MOOC, 2016 by Bill Rand @ Complexity Explorer ;; Contact: gpapad.gr@gmail.com ;; ---------------------------------------------------------------- globals [ annual-savers-rate% monthly-savers-rate minimum-expenditure total-deposit-amount total-outstanding-borrowing reserve-ratio total-non-performing-loans gini p10 p20 p30 p40 p50 p60 p70 p80 p90 ] breed [ households household ] ;; Define households' properties households-own [ budget has-loan? has-deposits? deposit-amount amount-withdrawn amount-needed available-this-month expenditure-this-month monthly-loan-payment monthly-loan-rate capital-repayment borrower-interest-payment outstanding-borrowing defaulter? ] to setup clear-all ask patches [ set pcolor white ] ;; Create household agents create-households num-households [ set shape "person" set color blue setxy random-pxcor random-pycor set has-loan? false set has-deposits? false set deposit-amount 0 set amount-withdrawn 0 set amount-needed 0 set available-this-month 0 set expenditure-this-month 0 set monthly-loan-payment 0 set monthly-loan-rate 0 set capital-repayment 0 set borrower-interest-payment 0 set outstanding-borrowing 0 set defaulter? false ;; Move turtles to free space if any? other turtles-here [ move-to one-of patches with [ not any? turtles-here ] ] ] ;; Assign budgets according to selected distribution (uniform, normal, exponential) following Hamill & Gilbert (2016) if income-distribution = "uniform" [ ask households [ set budget 350 + random ( 1000 + 350 ) ] ] if income-distribution = "normal" [ ask households [ set budget random-normal 1000 200 ] ] if income-distribution = "exponential" [ ask households [ set budget 350 + random-exponential ( 1000 - 300 ) ] ] if income-distribution = "gamma" [ let average 1000 let var 80000 let alpha average * average / var let lambda 1 / ( var / average ) ask households [ set budget random-gamma alpha lambda ] ] ;; Set minimum expenditure as 80% of minimum budget set minimum-expenditure 0.8 * min [ budget ] of households ;; Set reserve ratio ;; (1 - reserve-ratio) * deposits is the available amount for being lent set reserve-ratio 0.1 ;; directly in % ;; Initialize total deposits, loans and non-performing loans set total-deposit-amount 0 set total-outstanding-borrowing 0 set total-non-performing-loans 0 ;; (income) Inequality measure estimation update-gini percentile-calc reset-ticks end to go ;; The simulation will stop at 3 years (3 * 12 months) after the initiation of the stress scenario ;; This timeframe is typical for stress testing exercises if ticks >= ( shock-t + 36 ) and shock-t != 0 [ stop ] set total-deposit-amount sum [ deposit-amount ] of households with [ has-deposits? ] set total-outstanding-borrowing sum [ outstanding-borrowing ] of households with [ has-loan? ] set total-non-performing-loans sum [ outstanding-borrowing ] of households with [ defaulter? ] ;; Implement scenario ;; ------------------ ;; Mild shock if scenario = "mild shock" and ( ticks >= shock-t ) [ ;; The orange-ish color denotes the state of the economic "environment" ;; Households will take more conservative actions once in adverse (mild or severe) conditions ask patches [ set pcolor 27 ] ask households [ ;; Budget decreases by 0.2% each month or by approximately 2.4% per year set budget ( 0.998 * budget ) ] ;; Unemployment (budget = 0) rises by 2.4% per year (number based on 500 households due to rounding) let num-unemployed round ( 0.0015 * num-households ) ask n-of num-unemployed households with [ budget > 0 ] [ set budget 0 ] ] ;; Severe shock ;; This scenario reflects the 2010 sovereign debt crisis experienced in Greece (based on Eurostat data) if scenario = "severe shock" and ( ticks >= shock-t ) [ ;; The red-ish color denotes the state of the economic "environment" ;; Households will take more conservative actions once in adverse (mild or severe) conditions ask patches [ set pcolor 13 ] ask households [ ;; Budget decreases by 0.5% each month or by approximately 5.8% per year (number based on 500 households due to rounding) set budget ( 0.995 * budget ) ] ;; Unemployment (budget = 0) rises by about 5% per year let num-unemployed round ( 0.004 * num-households ) ask n-of num-unemployed households with [ budget > 0 ] [ set budget 0 ] ] ask households [ set available-this-month budget ;; Spend on basic needs ;; -------------------- ;; If budget greater than expenditure for basic needs (set as a percentage of minimum budget), then spend from it if ( budget >= minimum-expenditure ) [ spend-basic ] ;; If budget less than minimum expenditure, then withdraw from deposits, if any if ( budget < minimum-expenditure ) [ ;; Calculate the amount needed to meet basic needs set amount-needed ( minimum-expenditure - budget ) ;; If the needed funds are available, withdraw them from deposits and meet basic needs if ( amount-needed < deposit-amount ) [ withdraw-deposit spend-basic ] if ( amount-needed > deposit-amount ) [ set color grey ;; To show that this household is economically inactive ] ] ;; Collect interest on deposits, if any if has-deposits? [ collect-interest ] ;; Repay existing loan ;; ------------------- ;; If budget exceeds loan payment then repay loan if ( available-this-month > monthly-loan-payment ) [ pay-loan set defaulter? false ] ;; If budget is less than monthly loan payment withdraw from deposits, if any if ( available-this-month < monthly-loan-payment ) [ ;; Calculate the amount needed to meet the loan payment set amount-needed ( monthly-loan-payment - available-this-month ) ;; If the needed funds are available, withdraw them from deposits and pay the loan if ( amount-needed < deposit-amount ) [ withdraw-deposit pay-loan set color orange ;; To show that this household uses deposits to meet its needs set defaulter? false ] ;; If the needed funds are not available, declare household as a defaulter if ( amount-needed > deposit-amount ) [ set defaulter? true set color red ] ] ;; Ask for a new loan ;; ------------------ ;; Flip a coin to whether or not ask for a loan if random-float 1.0 < 0.5 and not has-loan? and not defaulter? [ ask-for-loan ] ;; Decide action with remaining budget ;; ----------------------------------- ;; Flip a coin to decide whether to spend or deposit the remaining budget, if any if available-this-month > 0 [ ifelse random-float 1.0 < 0.5 [ deposit ] [ spend-extra ] ] ;; Spend some of the deposits (thus simulating e.g. some luxury needs, buys etc) ;; If the economic conditions are adverse then the overall amount spent on luxuries is lower ;; ----------------------------------------------------------------------------------------- ;; Normal conditions if pcolor = white [ if random-float 1.0 < 0.5 [ let deposit%-to-spend random-float 0.3 set expenditure-this-month ( deposit%-to-spend * deposit-amount ) set deposit-amount ( 1 - deposit%-to-spend ) * deposit-amount ] ] ;; Adverse conditions if pcolor != white [ if random-float 1.0 < 0.5 [ let deposit%-to-spend random-float 0.1 set expenditure-this-month deposit%-to-spend * deposit-amount set deposit-amount ( 1 - deposit%-to-spend ) * deposit-amount ] ] ] ;; For househodlds that have repaid their loan ask households with [ outstanding-borrowing <= 0 ] [ set outstanding-borrowing 0 set has-loan? false set monthly-loan-payment 0 set monthly-loan-rate 0 set capital-repayment 0 set borrower-interest-payment 0 set color blue ] ;; (income) Inequality measure estimation update-gini percentile-calc tick end ;; ------------------ ;; PROCEDURES ;; ------------------ to spend-basic set expenditure-this-month minimum-expenditure set available-this-month ( available-this-month - minimum-expenditure ) end to deposit set deposit-amount ( deposit-amount + available-this-month ) set available-this-month 0 set has-deposits? true end to collect-interest let savers-interest-payment 0 set annual-savers-rate% 1.5 set monthly-savers-rate annual-savers-rate% / ( 12 * 100 ) set savers-interest-payment deposit-amount * monthly-savers-rate set deposit-amount ( deposit-amount + savers-interest-payment ) end to spend-extra set expenditure-this-month ( expenditure-this-month + available-this-month ) set available-this-month 0 end to ask-for-loan let annual-loan-rate% 0 let loan-term-months 0 let monthly-payment 0 let loan-size 5000 + random 20000 ifelse loan-size <= 10000 [ set annual-loan-rate% 5 set monthly-loan-rate ( annual-loan-rate% / 12 ) / 100 set loan-term-months 60 ;; 5 years ] [ set annual-loan-rate% 3 set monthly-loan-rate ( annual-loan-rate% / 12 ) / 100 set loan-term-months 120 ;; 10 years ] set monthly-payment ( loan-size * monthly-loan-rate ) / (1 - (( 1 + monthly-loan-rate) ^ ( - loan-term-months ))) ;; Reserve ratio requirement must be met if ( total-outstanding-borrowing + loan-size ) <= ( 1 - reserve-ratio ) * total-deposit-amount [ ;; Affordabiity test for loans. In its simplest form, budget should exceed monthly-payment + amount for basic needs ifelse affordability-test [ if not has-loan? and ( budget-payment-ratio * budget ) >= ( monthly-payment + minimum-expenditure ) [ set has-loan? true set outstanding-borrowing loan-size set monthly-loan-payment monthly-payment set deposit-amount deposit-amount + outstanding-borrowing set has-deposits? true set color green ] ] [ if not has-loan? [ set has-loan? true set outstanding-borrowing loan-size set monthly-loan-payment monthly-payment set deposit-amount deposit-amount + outstanding-borrowing set has-deposits? true set color green ] ] ] end to pay-loan if outstanding-borrowing > 0 and not defaulter? [ set borrower-interest-payment ( outstanding-borrowing * monthly-loan-rate ) set capital-repayment ( monthly-loan-payment - borrower-interest-payment ) set outstanding-borrowing ( outstanding-borrowing - capital-repayment ) set available-this-month ( available-this-month - monthly-loan-payment ) set expenditure-this-month ( expenditure-this-month + monthly-loan-payment ) ] end to withdraw-deposit set amount-withdrawn amount-needed set deposit-amount ( deposit-amount - amount-withdrawn ) set available-this-month ( available-this-month + amount-withdrawn ) end to update-gini let sorted-income sort [ budget ] of households let min-income min [ budget ] of households let total-income sum sorted-income let income-sum-so-far 0 let index 0 set gini 0 if total-income = 0 [set gini 0] if min-income < 0 [ set total-income total-income - num-households * min-income set index 0 repeat num-households [ set sorted-income replace-item index sorted-income ( item index sorted-income - min-income ) set index index + 1 ] ] set index 0 if total-income > 0 [ repeat num-households [ set income-sum-so-far ( income-sum-so-far + item index sorted-income ) set index (index + 1) set gini gini + (index / num-households) - (income-sum-so-far / total-income ) ] ] set gini (gini / num-households ) / 0.5 end to percentile-calc let sorted-income sort [ budget ] of households set p10 item ( round ( 0.1 * num-households ) ) sorted-income set p20 item ( round ( 0.2 * num-households ) ) sorted-income set p30 item ( round ( 0.3 * num-households ) ) sorted-income set p40 item ( round ( 0.4 * num-households ) ) sorted-income set p50 item ( round ( 0.5 * num-households ) ) sorted-income set p60 item ( round ( 0.6 * num-households ) ) sorted-income set p70 item ( round ( 0.7 * num-households ) ) sorted-income set p80 item ( round ( 0.8 * num-households ) ) sorted-income end

There is only one version of this model, created over 2 years ago by Georgios Papadopoulos.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Income distribution inequality and credit risk.png | preview | Preview for 'Income distribution inequality and credit risk' | over 2 years ago, by Georgios Papadopoulos | Download |

This model does not have any ancestors.

This model does not have any descendants.

Georgios Papadopoulos

## Some thoughts on the model

This model is the final project for the Introduction to Agent-Based Modeling MOOC, 2016 by Bill Rand in the Complexity Explorer. Being that, it is a work in progress and not a final product. It can be extended in several ways in order to more realistically reflect the behaviour of Households and Banks under normal and stressed economic conditions. However, it indicates that income inequality affects the banking system's exposure to credit risk. Any feedback regarding the model, its implementation or its results would be more than welcome.

## Posted over 2 years ago

elder silva

## Help Income project

Hi, My name is Elder, how do you plan to expand your project? I would help, I'm working with netlogo for the last two years, most of the time with a financial project. my contact is: elder0055@gmail.com Good luck, elder

## Posted over 2 years ago