Supply & Demand

No preview image

1 collaborator

Default-person Eric Horowitz (Author)

Tags

(This model has yet to be categorized with any tags)
Model group ls426_w11 | Visible to everyone | Changeable by the author
Model was written in NetLogo 4.1.2 • Viewed 1165 times • Downloaded 88 times • Run 1 time
Download the 'Supply & Demand' modelDownload this modelEmbed this model

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


WHAT IS IT?

This model simulates how the equillibrium price and quantity sold in a market emerge from individual decisions to buy or sell. In doing so the model provides and agent-based explanation for the laws of supply and demand. By watching the actions of individual agents one can see why an increase in demand leads to increases in price and quantity (and vice versa), and why an increase in supply leads to a decrease in price and increase in quantity sold (and vice versa).

HOW IT WORKS

The model consists of 50 "buyers" (people shape) and 50 "sellers" (car shapes). Each buyer has a specific price they are willing to pay for a car. Each seller has a specific price for which they are willing to sell their car. When the model is run each buyer willing to pay more than the market price will attempt to buy a car. Each seller willing to sell for less than the market price will attempt to sell their car. The buyer and sellers interested in making a deal will turn yellow.

At each tick the buyers interested in buying randomly move around. When they find a seller willing to sell, a deal is made and both the buyer and seller turn green to show their satisfaction. If interested buyers remain after there are no longer interested sellers, the model stops and these buyers turn red to show their dissatisfaction. Similarly, if interested sellers remain after there are no longer interested buyers, the model stops and these sellers turn red to show their dissastisfaction.

When the PRICE-ADJUSTING button is "on" the model does not stop when there are angry buyers or sellers. Instead, at the next tick the price moves up or down by one dollar. If there are angry buyers the price will move up. This simulates sellers raising the price because they realize doing so will not lead to a decrease in sales. Similarly, when there are angry sellers, at the next tick the price decreases by one dollar. This simulates angry sellers willing to sell for less than the market price who now decide to offer a lower price in order to ensure they make a sale. When the PRICE-ADJUSTING button is "on" the model will always move to the equillibrium price and quantity.

The CHANGE-IN-DEMAND and CHANGE-IN-SUPPLY silders simulate increases in supply and demand. The buttons work by changing the amount of money buyers and sellers are willing to pay or receive. For example, increasing demand by 4 will increase the price every buyer is willing to pay by $4. This simulates an increase in demand because it effectively means that an any price, there are now four additional buyers willing to buy. Similarly, increasing supply by 4 will lower the price every seller is willing to sell for by 4$. This similates an increase in supply because it effectively means that an any price, there are now four more sellers willing to sell.

HOW TO USE IT

The SETUP button sets up the market of 50 buyers and 50 sellers. Initially they are all white to show that nobody is interesting in any action.

The INITIAL-PRICE slider sets the initial price in the market. If the PRICE-ADJUSTING button is on the price will change at each tick.

The PRICE-ADJUSTING button determines whether angry buyers and sellers will adjust the prices they offer, and consequently the market price, in order to become happy.

The CHANGE-IN-DEMAND slider controls the change in demand.

The CHANGE-IN-SUPPLY slider controls the change in supply.

If the goal is simply to see what will happen at a certain price, begin with an INTITIAL-PRICE and run the model. Adjust the CHANGE-IN-DEMAND and CHANGE-IN-SUPPLY sliders to find out what happens and different levels of supply and demand. To make the model converge on the equillibrium price and and quantity, simply turn on the PRICE-ADJUSTING button."

THINGS TO NOTICE

At low prices, almost all buyers are angry, while at high prices, almost all sellers are angry. When buyers become angry, they are always willing to pay more than the market price. Similarly, when sellers become angry, they are always willing to sell for less than the market price. This is the reasoning behind why the model changes the market price.

THINGS TO TRY

Run the model with varying increase or decreases in supply and demand. Do increases in demand always lead to increases in price and quantity? Do increases in supply always lead to decreases in price?

EXTENDING THE MODEL

This model contains a very limited number of homogenous buyers and sellers who all react uniformly to changes in supply and demand. An extension to the model could allow the user to adjust the number of buyer and sellers, or create different breeds of buyers and sellers who react differently to various market outcomes (e.g. becoming angry, change in demand, etc.).

Comments and Questions

Click to Run Model

Globals [price producer-surplus consumer-surplus Total-Surplus]
Breed [Buyers Buyer]
Breed [Sellers Seller]
Buyers-own [willingtopay consumersurplus]
Sellers-own [willingtosellfor producersurplus]
turtles-own [partner]

to setup
  
  clear-all                                                     ;clear the world
  create-Buyers 50                                              ;create buyers, put them in random places
  [
  setxy random-xcor random-ycor
  ]
  create-Sellers 50                                                ;create Sellers, put them in random places
  [
   setxy random-xcor random-ycor
  ]
  ask buyers [set shape "buyersleeping" set size 1.6]                        ;give buyers default neutral shapes
  ask Sellers [set shape "sellersleeping" set size 1.6]                            ;give Sellers default neutral shapes        
  ask Buyers [set willingtopay (who + 50 + Change-in-Demand)]    ;set price buyers are willing to pay
  ask Sellers [set willingtosellfor (who + 1 - Change-in-Supply)] ;set price Sellers are willing to sell for
  set price Initial-Price                               ;converts price set by slider into variable that can change
  set consumer-surplus 0                                        ; set surplusses to 0
  set producer-surplus 0
  set total-surplus 0
  ask turtles [set partner nobody] 
end 

to go
  ;these commands repeat most of the startup procedures for when "go" is called after a price change
  update-plot
  ask buyers [set shape "buyersleeping" set size 1.6]
  ask sellers [set shape "sellersleeping" set size 1.6]
  ask turtles [set partner nobody] 
  ask buyers [set consumersurplus (willingtopay - price)]
  ask sellers [set producersurplus (price - willingtosellfor)]
  set consumer-surplus 0
  set producer-surplus 0
  set total-surplus 0
  
  ;if you're a buyer willing to buy and haven't bought, show that you're looking
  ask buyers [if willingtopay >= price and partner = nobody and not any? buyers with [shape = "buyermad"][set shape "buyerlooking"]]
  
  ;if you're a seller willing to sell haven't sold, and there are buyers, show that you're selling.
  ask sellers [if willingtosellfor <= price and partner = nobody and not any? sellers with [shape = "sellermad"][set shape "sellerlooking"]]
  
  ;if you're a buyer willing to buy and haven't bought, find a car to buy
  ask buyers [if shape = "buyerlooking" [findseller]]
  
  ;if you're a seller who wants to sell and there are no buyers left, look angry
  ask sellers [if willingtosellfor <= price and partner = nobody and not any? buyers with [shape = "buyerlooking"] [set shape "sellermad"]]
  ;if nobody is looking to buy or sell, stop and announce the equilibrium price ahs been reached
  if not any? sellers with [shape = "sellerlooking"] 
     and not any? sellers with [shape = "sellermad"]
        and not any? buyers with [shape = "buyerlooking"] 
           and not any? buyers with [shape = "buyermad"]
              [output-print " " output-type "Equilibrium price reached! " output-type count sellers with [partner != nobody] output-type " Cars sold for $" output-type price output-type " each."  update-plot stop]
  
  ;if buyers and sellers are angry, and they are willing to adjust prices, make them adjust their prices
  if any? buyers with [shape = "buyermad"] and price-adjusting [raiseprice]
  if any? sellers with [shape = "sellermad"] and price-adjusting [lowerprice]
  
  ;if buyers and sellers are angry, but they are not willing to adjust prices, stop and announced they are angry
  if any? buyers with [shape = "buyermad"] and not price-adjusting [output-print "Buyers are angry!" stop]
  if any? sellers with [shape = "sellermad"] and not price-adjusting [output-print "Sellers are angry!" stop]
end 

to findseller
  ;if there are buyers who want to buy, but can't, make them mad
  ask buyers [if willingtopay >= price and partner = nobody and not any? sellers with [shape = "sellerlooking"] [set shape "buyermad"]]
  
  ;if there are sellers who want to sell, but can't, make them mad
  ask sellers [if willingtosellfor <= price and partner = nobody and not any? buyers with [shape = "buyerlooking"] [set shape "sellermad"]]
  
  ;if there are sellers left who want to sell, wander around and look for them
  if any? sellers with [shape = "sellerlooking"] and partner = nobody [lt random 40 rt random 40 fd 1 checkseller]
end 

to checkseller
  ;if there is a Seller who hasn't sold who wants to sell on this spot, buy it and make both of you happy.
  if any? other turtles-here with [(partner = nobody) and (shape = "sellerlooking")]
       [set partner one-of other turtles-here with [partner = nobody and shape = "sellerlooking"] 
       set shape "buyerhappy"
       set consumer-surplus consumer-surplus + (consumersurplus)
       ask partner [set partner myself set shape "sellerhappy" set producer-surplus producer-surplus + (producersurplus)]]
  set total-surplus consumer-surplus + producer-surplus
  
  ;if there's not a seller here, look somewhere else
  if not any? other turtles-here with [shape = "sellerlooking"][findseller]
end 

to raiseprice
  ;announce your are raising the price, then raise the price
  Output-print "Buyers are angry there are no cars to buy." output-print "Sellers realize they can raise prices without losing sales." output-type "Sellers raise price to $" output-type price + 1 output-print "." 
         output-print " "
  set price (price + 1)
  wait 2
  go
end 

to lowerprice
  ;announce you are lowering the price, then lower the price
  Output-print "Sellers are angry nobody will buy their car." output-type "Sellers drop price to $" output-type price - 1
       output-print "." output-print " "
  set price (price - 1)
  wait 2
  go
end 

to update-plot
set-current-plot "Price & Quantity"
set-current-plot-pen "Price"
plot price
set-current-plot-pen "Quantity"
plot count sellers with [shape = "sellerhappy"]
set-current-plot "Change in Surplus"
set-current-plot-pen "Total Surplus"
plot Total-Surplus
set-current-plot "Change in Surplus"
set-current-plot-pen "Producer Surplus"
plot Producer-Surplus
set-current-plot "Change in Surplus"
set-current-plot-pen "Consumer Surplus"
plot Consumer-Surplus
end 
  

There are 4 versions of this model.

Uploaded by When Description Download
Eric Horowitz over 11 years ago No description provided Download this version
Eric Horowitz almost 12 years ago No description provided Download this version
Eric Horowitz almost 12 years ago No description provided Download this version
Eric Horowitz almost 12 years ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.