Computational Model Library

BAM: The Bottom-up Adaptive Macroeconomics Model (version 1.1.0)



Modeling an economy with stable macro signals, that works as a benchmark for studying the effects of the agent activities, e.g. extortion, at the service of the elaboration of public policies..

Entities, state variables, and scales

  • Agents: Firms (also know as producers), workers (also know as consumers and households) and banks.

  • Environment: Virtual or geographically characterized markets.

    • Labor market.

    • Goods market

    • Credit market.

  • State variables: Productivity, net worth, wage and loans.

Process overview and scheduling

  1. Firms calculate production based on expected demand.

  2. A decentralized labor market opens.

  3. A decentralized credit market opens.

  4. Firms produce.

  5. Market for goods open.

  6. Firms will pay loan and dividends.

  7. Firms and banks will survive or die.

  8. Replacing of bankrupt firms/banks.

Design concepts

Basic Principles

Neo classical economy.


Model as a whole has the objective of generating adaptive behavior of the agents, without the imposition of an equation that governs the actions of the agents.


Firms can adapt in each period $t$ price or amount to supply (only one of the two strategies). Adaptation of each strategy depends on the condition of the firm (level of excessive supply / demand in the previous period) and/or the market environment (the difference between the individual price and the market price in the previous period).


Just firms has the objetive of maximizing their net worth.


Firms do not have learning, they present different responses to an environment that is constantly evolving.


Firms use both their own elements and the environment to make the prediction of the quantity to be produced or the price. As an internal element, it uses the excessive amount of supply / demand in the previous period; while the environment takes the differential of its price and the market.


  • Firms are able to perceive their produced quantity, their price and the market price, offered wages, profits, net value, their labor force and interest rate of randomly chosen banks.

  • Workers/consumers perceive the size of firms visited in the previous period, prices published by the firms in actual period and wages offered by the firms.

  • Banks are able to sense net value of potential borrower (firms) in order to calculate interest rate.


Macroeconomic results come from continuous adaptive dispersed interactions of autonomous, heterogeneous and rationally bounded agents that coincide in an uncertain environment.


Elements that have random shocks are:

  • Determination of wages (when vacancies are offered), wages-shock-xi.

  • Determination of contractual interest rate offered by banks to
    firms, interest-shock-phi.

  • Strategy to set prices, price-shock-eta.

  • Strategy to determine the quantity to produce, production-shock-rho.


In addition to the sets of agents (consumers, producers and banks), groups of firms and consumers are selected as an emergent property of the simulation (rich and poor).


Along simulation are observed:

  • Logarithm of real GDP.

  • Unemployment rate.

  • Annual inflation rate.

At end of simulation are computed:

  • Distribution of the size of firms.



Parameter Parameter Value
I Consumers 500
J Producers 100
K Banks 10
T Periods 1000
C<sub>P</sub> Propensity to consume of poorest people 1
C<sub>R</sub> Propensity to consume of richest people 0.5
h<sub>&xi</sub> Maximum growth rate of wages 0.05
H<sub>&eta</sub> Maximum growth rate of prices 0.1
H<sub>&rho</sub> Maximum growth rate of quantities 0.1
H<sub>&phi</sub> Maximum amount of banks’ costs 0.1
Z Number of trials in the goods market 2
M Number of trials in the labor market 4
H Number of trials in the credit market 2
Minimum wage (set by a mandatory law) 1
P<sub>t<sub></sub></sub> Base price 1
&delta Fixed fraction to share dividends 0.15
Interest rate (set by the central monetary authority) 0.07

Input data

No input data were needed to represent process.


  1. Production with constant returns to scale and technological multiplier.


  2. Desired production level eqn-02-a is equal to the expected
    demand eqn-02-b.

  3. Desired labor force (employees) eqn-03-a is


  1. Current number of employees eqn-04 is the sum of employees with and without a valid contract.

  2. Number of vacancies offered by firms eqn-05-a is


  3. eqn-06 is the minimum wage determined by law.

  4. If there are no vacancies eqn-07-a, wage offered is:


  1. If number of vacancies is greater than 0, wage offered is:


  1. eqn-09-a is a random term evenly distributed between

  2. At the beginning of each period, a firm has a net value eqn-10-a.
    If total payroll to be paid eqn-10-b is greater than eqn-10-c,
    firm asks for a eqn-10-d loan:


  3. For the loan search costs, it must be met that eqn-11

  4. In each period the eqn-12-a -thmost bank can distribute a total amount
    of credit eqn-12-b equivalent to a multiple of its patrimonial base:


  5. where eqn-13-a can be interpreted as the capital requirement
    coefficient. Therefore, the eqn-13-b reciprocal represents the maximum
    allowed leverage by the bank.

  6. Bank offers credit eqn-14-a, with its respective interest rate
    eqn-14-b and contract for 1 period.

  7. Payment scheme if eqn-15-a:


  8. If eqn-16-a, bank retrieves


  9. Contractual interest rate offered by the bank eqn-17-a to the firm
    eqn-17-b is determined as a margin on a rate policy established by
    Central Monetary Authority eqn-17-c:


  10. Margin is a function of the specificity of the bank as possible
    variations in its operating costs and captured by the uniform random
    variable eqn-18-a in the interval eqn-18-b.

  11. Margin is also a function of the borrower’s financial fragility,
    captured by the term eqn-19-a, eqn-19-b. Where


    is the leverage of borrower.

  12. Demand for credit is divisible, that is, if a single bank is not
    able to satisfy the requested credit, it can request in the
    remaining eqn-20 randomly selected banks.

  13. Each firm has an inventory of unsold goods eqn-21-a, where excess
    supply eqn-21-b or demand eqn-21-c is reflected.

  14. Deviation of the individual price from the average market price
    during the previous period is represented as:


  15. If deviation is positive eqn-23, firm recognizes
    that its price is high compared to its competitors, and is induced
    to decrease the price or quantity to prevent a migration massive in
    favor of its rivals.

  16. Vice versa.

  17. In case of adjusting price to downside, this is bounded below
    eqn-25-a to not be less than your average costs

  18. Aggregate price eqn-26-a is common knowledge (global variable), while
    inventory eqn-26-b and individual price eqn-26-c private
    knowledge child (local variables).

  19. Only the price or quantity to be produced can be modified. In the
    case of price, we have the following rule:
    $$\begin{aligned} P_{it}^s= ​ \begin{cases} ​ \text{max}[P_{it}^l, P_{it-1}(1+\eta_{it})] & \text{if $S_{it-1}=0$ and $P_{it-1}<P$ }\\ ​ \text{max}[P_{it}^l, P_{it-1}(1-\eta_{it})] & \text{if $S_{it-1}>0$ and $P_{it-1}\geq ​ P$} ​ \end{cases}\end{aligned}$$

  20. eqn-28-a is a randomized term uniformly distributed in the
    range eqn-28-b and eqn-28-c is the minimum price at which firm
    eqn-28-d can solve its minimal costs at time eqn-28-e
    (previously defined).

  21. In the case of quantities, these are adjusted adaptively according
    to the following rule:

    ​ \begin{cases}
    ​ Y_{it-1}(1+\rho_{it}) & \text{if $S_{it-1}=0$ and $P_{it-1}\geq P$} \
    ​ Y_{it-1}(1-\rho_{it}) & \text{if $S_{it-1}>0$ and $P_{it-1}< P$}
    ​ \end{cases}\end{aligned}$$

  22. eqn-30-a is a random term uniform distributed and bounded
    between eqn-30-b.

  23. Total income of households (workers/consumers) is the sum of the
    payroll paid to the workers (each household represents a worker) in
    eqn-31-a and the dividends distributed to the shareholders in eqn-31-b.

  24. Wealth is defined as the sum of labor income plus the sum of all
    savings eqn-32 of the past.

  25. Marginal propensity to consume eqn-33-a is a decreasing function of the
    worker’s total wealth (higher the wealth lower the proportion spent
    on consumption) defined as:


  26. eqn-34-a is the average savings. eqn-34-b is the real saving of
    the eqn-34-a -th consumer.

  27. The revenue eqn-35-a of a firm after the goods market closes is
    equal to:


  28. At the end of eqn-36-a period, each firm computes benefits

  29. If the benefits are positive, the shareholders of firms receive


  30. Residual, after discounting dividends, is added to net value
    inherited from previous period, eqn-38-a. Therefore, net worth of
    a profitable firm in eqn-38-a is:


  31. If firm, say eqn-39-a, accumulates a net value eqn-39-b
    goes bankrupt.

  32. Firm that goes bankrupt is replaced with another one of smaller size
    than the average of incumbent firms.

  33. Non-incumbent firms are those whose size is above and below 5%, is
    used to calculate a more robust estimator of the average.

  34. Bank’s capital


  35. eqn-43-a is the bank’s loan portfolio, eqn-43-b represents
    the portfolio of firms that go bankrupt.

  36. If a bank goes bankrupt, it is replaced with a copy of the
    surviving banks.


Delli Gatti, D. et. al, (2011). Macroeconomics from the Bottom-up. Springer-Verlag Mailand, Milan.

Release Notes

  1. Set configuration of parameters.
  2. Click Setup with your prefered parameters.
  3. Click Go
  4. Simulation will stop at 1000 ticks.
  5. Initial configuration of parameters gives an average economy, according to data from World Bank.

Version Submitter First published Last modified Status
1.1.0 Alejandro Platas López Sun Jul 26 00:26:21 2020 Sun Jul 26 00:26:21 2020 Published Peer Reviewed
1.0.0 Alejandro Platas López Tue Jan 14 17:04:32 2020 Tue Jan 14 17:04:32 2020 Published Peer Reviewed


This website uses cookies and Google Analytics to help us track user engagement and improve our site. If you'd like to know more information about what data we collect and why, please see our data privacy policy. If you continue to use this site, you consent to our use of cookies.