## "Aggregate demand and supply."

The applet requires Java 1.5 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.

created with NetLogo

## WHAT IS IT?

In a generic market the interactions between buyers and sellers can be simulated by observing single supply and demand functions and then aggregating them.
This project simulates a simple market constituted by agents with linear single demand and supply functions. Aggregate demand and supply functions are then generated. The model evaluates equilibrium price and quantity at every step.

## HOW IT WORKS

For every turtles (agents) a single linear demand or supply function is generated. Step by step every agent randomly choses to be either buyer or seller.
Linear functions are generated according to the equation:
y=a+bx : demand function
y=c+dx : supply function
where y is the quantity and x is the price.
Single demand (supply) function is defined choosing values a,b (c,d) representing intercept and slope of the line.
These values are random for every agent, and they are generated through uniformly distributed shocks in the parameters:
set a (alfa + ((random-float 1) - 0.5)* w )
set b (-10 + ((random-float 1) - 0.5)* k )
for demand function, and
set c (gamma + ((random-float 1 )- 0.5)* z)
set d (10 + ((random-float 1 )- 0.5)* j)
for supply function.
To aggregate the functions, given two prices p1 and p2, single quantities are added up obtaining two points of the aggregate demand (supply): given these points of the aggregate demand (supply) the curve is obtained by interpolation.
Setting aggregate demand equal to aggregate supply we obtain equilibrium price and quantity.

## HOW TO USE IT

1) Before SETUP it is possible to modify the following parameters with the appropriate sliders:
NUMBER: number of agents
ALFA: constant of demand function intercept
GAMMA: constant supply function intercept
W: to increase range of variation in single demand intercept
K: to increase range of variation in single demand slope
Z: to increase range of variation in single supply intercept
J: to increase range of variation in single supply slope
NUMBER-OF_STEPS: number of steps
LIMIT-SPEED?: wait the given number of seconds (if the switch is "on")

Except the slider NUMBER all others can be changed while the simulation is running.
2) Playing SETUP turtles are created.
3) Playing GO it will start the simulation. Equilibrium price and quantity are plotted at every step.

## THINGS TO NOTICE

Modifying parameters which influence intercepts, the equilibrium price and quantity have an increase in volatility, and a major increment in quantity is noticed.
This parameter has been kept intentionally high to have variability in prices (but intercepts of some buyers or sellers could be negative). In the volume graph, instead, the increment of volatility is easily noticed even with many agents, and more clear with few ones.
Hence, during the simulation, the variation of parameters alfa and gamma could be interpreted as a "shock" in aggregated demand and aggregated supply, which modify the equilibrium price.
Increasing gamma, the main component for single supply functions, the function of aggregated supply is shifted up generating a decerease in the equilibrium price and an increase in equilibrium quantity.
In the same way increasing alfa the aggregated demand function is shifted up, generating an increase in equilibrium price and equilibrium quantity.

## THINGS TO TRY

Hence, during the simulation, the variation of parameters alfa and gamma could be interpreted as a "shock" in aggregated demand and aggregated supply, which modify the equilibrium price.
Increasing gamma, the main component for single supply functions, the function of aggregated supply is shifted up generating a decerease in the equilibrium price and an increase in equilibrium quantity.
In the same way increasing alfa the aggregated demand function is shifted up, generating an increase in equilibrium price and equilibrium quantity.

## EXTENDING THE MODEL

The model can be improved in different ways in order to show a more accurate and realistic market, for example, using agents with non-linear demand and supply function or using intelligent adaptive agents. [see "Terna, 2002A"].

## RELATED MODELS

This simulation is based upon the general concept in [Terna, Boero, Morini, Sonnessa "Modelli per la complessità. La simulazione ad agenti in economia". Ed. Il Mulino 2006. http://abm.econ.unito.it/]