Chapter 6 Supply and demand dynamics

Report 40 Downloads 200 Views
Chapter 6 Supply and demand dynamics O. Afonso, P. B. Vasconcelos

Computational Economics: a concise introduction

O. Afonso, P. B. Vasconcelos

Computational Economics

1 / 26

Overview 1

Introduction

2

Economic model

3

Numerical solution

4

Computational implementation

5

Numerical results and simulation

6

Highlights

7

Main references

O. Afonso, P. B. Vasconcelos

Computational Economics

2 / 26

Introduction

In 1930, Ricci, Tinbergen and Shultz published studies containing the first explicit cobweb model(s). It is considered that the quantity supplied is a function of the price of the preceding time period. Then, by describing cyclical supply and demand, it explains why prices can be subject to periodic fluctuations. For some slopes of the demand and supply curves, the equilibrium can be reached. The assumption that supply must equal demand can be relaxed, as in the case of the market model with inventory. Since supply reacts with a one–period lag to market prices, producers have an inventory to meet unexpected demand. These models are presented to illustrate the use of first-order difference equations in economic analysis, following Gandolfo (2010), Chiang (2005) and Pashigian (2008).

O. Afonso, P. B. Vasconcelos

Computational Economics

3 / 26

Economic model

Cobweb model The cobweb model is based on a time lag between supply and demand decisions. Producer’s output decision must be made one period in advance; suppose that producers go to market with an unusually small production. This shortage results in high prices and if producers expect these high price conditions to continue in the following period, they will raise the production and, as a result, prices decrease. If low prices are expected to continue, producers will decrease the production, resulting again in higher prices. Thus, oscillating between periods of low supply with high prices and high supply with low prices, the set price-quantity traces out a spiral. This set may spiral inwards and the economy converges to the equilibrium or it may spiral outwards and the economy diverges since the fluctuations increase in magnitude: there is convergence if the supply curve is steeper than the demand curve, and vice versa. O. Afonso, P. B. Vasconcelos

Computational Economics

4 / 26

Economic model

Assume that the output decisions in time t are based on the current price, Pt ; thus, Pt determines Qs,t+1 or, equivalently, Pt−1 affects Qs,t , which, interacting with a demand function, imposes dynamic price patterns. The standard equations that characterise the market are: demand, Qd,t = Q d − aPt ; supply, Qs,t = Q s + bPt−1 ; equilibrium, Qd,t = Qs,t . It is assumed that the price at t is set at a level which clears the market. The endogenous variables are: quantity demanded, Qd,t ; quantity offered, Qs,t ; and price of the good, Pt . The exogenous variables are: independent/autonomous quantity demanded, Q d ; and independent/autonomous quantity offered, Q s . Parameters are: a, b > 0, respectively, the sensitivity of the demand to price at time t and the sensitivity of the supply to price at time t − 1.

O. Afonso, P. B. Vasconcelos

Computational Economics

5 / 26

Economic model

Demand

Qd,t is the total amount of a good that buyers would choose to purchase given the price of the good, Pt , as well as other variables, represented by the exogenous variable Q d . The Law of Demand states that, ceteris paribus, when the price of a good rises, the quantity of the good demanded falls. A Demand Curve (or line) is a graphical representation of the relationship between price and quantity demanded, assuming that everything else remains constant. Changes in demand occur when one of the determinants of demand other than price changes; i.e. ‘when the ceteris are not paribus’.

O. Afonso, P. B. Vasconcelos

Computational Economics

6 / 26

Economic model

Supply

Qs,t is the total amount of a good that sellers would choose to produce and sell given the price of the good at the previous time period, Pt−1 , as well as other variables, represented by the exogenous variable Q s . The Law of Supply states that, ceteris paribus, when the price of a good at the previous time period rises, the quantity of the good supplied also rises. A Supply Curve (or line) is a graphical representation of the relationship between the price in the previous period and quantity supplied (ceteris paribus). Changes in supply occur when one of the determinants of supply other than the price of the previous period changes.

O. Afonso, P. B. Vasconcelos

Computational Economics

7 / 26

Economic model

Putting the demand and the supply curves together By substituting Qd,t and Qs,t in Qd,t = Qs,t , the model can be reduced to a single first-order difference equation: aPt + bPt−1 = Q d − Q s , which, since a 6= 0, can be rewritten as b Qd − Qs Pt+1 = − Pt + . a a

(1)

Now, equation (1) can be rewritten in terms of P0 , by replacing Pt by s s − ba Pt−1 + Q d −Q and then Pt−1 by − ba Pt−2 + Q d −Q and so on. a a Rewriting for t instead of t + 1, ! t Qd − Qs b Qd − Qs Pt = P0 − − + . a+b a a+b

O. Afonso, P. B. Vasconcelos

Computational Economics

8 / 26

Economic model

Three points are crucial in regard to the time path. 1

2

3

d −Q s The expression Qa+b can be interpreted as the inter-temporal equilibrium price, which, being constant, is the stationary equilibrium. d −Q s The sign of P0 − Qa+b bears on the question of whether the time path starts above or below the equilibrium (mirror effect), whereas its magnitude decides how far above or below (scale effect).

The expression − ba generates an oscillatory time path and, consequently, gives rise to the cobweb phenomenon, showing three possible varieties of oscillation patterns: explosive if b>a; uniform if b=a; damped if b 0 is the (inventory) price-adjustment parameter.

O. Afonso, P. B. Vasconcelos

Computational Economics

10 / 26

Economic model

Market model with inventory

By substituting the demand and supply equations in the price-setting equation, the model can be condensed into a single first-order difference equation,   Pt+1 = (1 − σ (a + b)) Pt + σ Q d − Q s , (2) and the solution is given by Pt =

Qd − Qs P0 − a+b

! t

(1 − σ (a + b)) +

Qd − Qs . a+b

The dynamic stability of the model will hinge on the expression 1 − σ (a + b). 2 The method converges whenever |1 − σ (a + b)| < 1, that is, for 0 < σ < a+b .

O. Afonso, P. B. Vasconcelos

Computational Economics

11 / 26

Numerical solution

Difference equations

Dynamical systems describe the evolution of certain quantities over time, and here time is considered to be discrete. A first–order discrete dynamic system is a sequence of numbers given by a relation (first–order difference equation) yt+1 = f (yt ), where f (yt ) can be linear or not, giving rise to linear and nonlinear difference equations. If the system depends also on t itself, then it is said to be nonautonomous and autonomous otherwise. Equations (1) and (2) are of the form yt+1 = f (yt ) + g(t), with g(t) a constant function, both examples of autonomous first order difference equations; they are also nonhomogeneous since g(t) 6= 0, otherwise they would be homogeneous.

O. Afonso, P. B. Vasconcelos

Computational Economics

12 / 26

Numerical solution

Difference equations An nth–order difference equation involves more than one–period time lag, yt+n = f (yt+n−1 , ..., yt ). The solution of a nonhomogeneous linear equation X yt+n + cn−i yt+n−i = g(t) i=1,...,n

with constant coefficients cn−1 , ..., c0 , can be obtained from the sum of a complementary function, yc , solution of the homogeneous part, and with a particular solution, yp , any solution of the nonhomogeneous part.

For a first–order problem, a complementary solution can be obtained by trying a solution of the form k λt , giving rise to yt = k λt + yp , where k is specified provided that an initial condition at t = 0 is given. The particular solution can be interpreted as the equilibrium state and yt − yp = k λt gives the deviation from the equilibrium. O. Afonso, P. B. Vasconcelos

Computational Economics

13 / 26

Numerical solution

Difference equations

The stability of the solution depends on the complementarity solution; when t → ∞ the solution is convergent (divergent) if |λ| < 1 (|λ| > 1); furthermore, the cases |λ| = 1 are also divergent; if λ < 0 (λ > 0) the time path of λt is oscillatory (nonoscillatory). For the cobweb model, λ = − ba and since both a and b are positive, oscillatory behaviour is shown.

O. Afonso, P. B. Vasconcelos

Computational Economics

14 / 26

Numerical solution

Difference equations For a second–order problem, the solution of the complementarity problem is obtained trying a solution of the form λt in yt+2 + c1 yt+1 + c0 yt = 0: λt+2 + c1 λt+1 + c0 λt = 0 λ2 + c1 λ + c0 = 0

(3)

for λ 6= 0. The two sought roots of the second–order (characteristic) polynomial are the solution of equation (3), the characteristic equation: if λ1 , i = 1, 2 are distinct real roots, yt = k1 λt1 + k2 λt2 , for two constants k1 and k2 ; if λ = λ1 = λ2 , yt = k1 λt + k2 tλt , for two constants k1 and k2 ; if λ1 = a − ib and λ2 = a + ib are complex √ (conjugate), yt = ρt (k1 cos(wt) + k2 sin(wt)), with ρ = a2 + b2 and w = tg −1 (b/a).

O. Afonso, P. B. Vasconcelos

Computational Economics

15 / 26

Numerical solution

Difference equations With respect to stability, convergence will occur: for real distinct roots whenever |λ1 | < 1 and |λ2 | < 1; for a real root of multiplicity 2 whenever |λ| < 1; for conjugate complex roots when ρ < 1 (with a trigonometric oscillation). For an nth–order difference linear equation, solutions are combinations of those presented for the second–order and the path towards the equilibrium is governed by the n roots of an nth–order polynomial. Linear difference equations, with constant coefficients, play an important role in scientific problems, particularly in economics: the convergence behaviour of the time path can be well understood. Nonlinear equations are far more difficult to solve (analytically) than the linear counterpart since many of them are not solvable in terms of elementary functions; nevertheless, solutions can be obtained by iterating the equation numerically on a computer easily.

O. Afonso, P. B. Vasconcelos

Computational Economics

16 / 26

Numerical solution

Roots of polynomials in practice MATLAB/Octave: roots(p) returns the roots of the polynomial p. For example, the roots of polynomial p = λ2 + 2 ∗ λ − 1 can be obtained from: p=[1 2 -3], roots(p). There is an important relation between the roots of a polynomial and the eigenvalues of the associated companion matrix, which for a monic polynomial λn + c1 λn−1 + ... + c1 λ + c0 is the n × n matrix   −cn−1 −cn−2 . . . −c1 −c0  1 0 ... 0 0     0 1 ... 0 0     .. .. .. ..  ..  . . . . .  0

0

...

1

0

and it is the result of the command compan(p), where p is the vector of polynomial coefficients. The eigenvalues are the polynomial roots eig(compan(p)). The function eig will be explained in the next chapter. O. Afonso, P. B. Vasconcelos

Computational Economics

17 / 26

Computational implementation

The following baseline values are considered: Q d = 1000, Q s = 250, a = 10 and b = 5.

O. Afonso, P. B. Vasconcelos

Computational Economics

18 / 26

Computational implementation

Presentation and parameters %% Cobweb model % Implemented by : P . B . Vasconcelos and O. Afonso clear ; clc ; disp ( ’−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ’ ) ; disp ( ’ Cobweb model ’); disp ( ’−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ’ ) ; %% parameters a = 1 0 ; % s e n s i t i v i t y o f t h e demand t o p r i c e b = 5; % s e n s i t i v i t y of the supply to p r i c e %% exogenous v a r i a b l e s Qd_bar = 1000; % independent / autonomous q u a n t i t y demanded Qs_bar = 250; % independent / autonomous q u a n t i t y o f f e r e d %% model f p r i n t f ( ’Qd, t = %g − %g∗ Pt \ n ’ , Qd_bar , a ) % demand f p r i n t f ( ’ Qs , t = %g + %g∗Pt−1 \ n ’ , Qs_bar , b ) % s u p p l y f p r i n t f ( ’Qd, t = Qs , t \ n ’ )

O. Afonso, P. B. Vasconcelos

Computational Economics

19 / 26

Computational implementation

Solution %% compute t h e endogenous v a r i a b l e s tmax = 100; t o l = 1e−5; % maximum nb o f p e r i o d s and t o l e r a n c e t = 1 ; P ( t ) = 2 5 ; Qs ( t ) = NaN ; % i n i t i a l p r i c e ; no v a l u e f o r Q disp ( ’ t Qt Pt ’ ) f p r i n t f ( ’ %d \ t \ t %5.2 f \ n ’ , t −1,P ( t ) ) t = 2; Qs ( t ) = Qs_bar+b∗P ( t −1) ; P ( t ) = −b / a∗P ( t −1) +( Qd_bar−Qs_bar ) / a ; f p r i n t f ( ’ %d \ t %5.2 f \ t %5.2 f \ n ’ , t −1,Qs ( t ) ,P ( t ) ) while t t o l ∗P ( t ) t = t +1; Qs ( t ) = Qs_bar+b∗P ( t −1) ; P ( t ) = −b / a∗P ( t −1) +( Qd_bar−Qs_bar ) / a ; f p r i n t f ( ’ %d \ t %5.2 f \ t %5.2 f \ n ’ , t −1,Qs ( t ) ,P ( t ) ) end %% cobweb p l o t s Qd ( 2 : length ( Qs ) ) = Qd_bar−a∗P ( 1 : length ( Qs ) −1) ; Qd ( 1 ) = NaN ; cobweb_plots ( Qd_bar , Qs_bar , a , b , P , Qs , Qd) O. Afonso, P. B. Vasconcelos

Computational Economics

20 / 26

Computational implementation

Cobweb plots function cobweb_plots ( Qd_bar , Qs_bar , a , b , P , Qs , Qd) % Cobweb p l o t s : p r i c e , q u a n t i t y cobweb p l o t , p r i c e phase diagram % plot axis l i m i t s ymin = min ( P ) ∗ . 9 5 ; ymax = max( P ) ∗ 1 . 0 5 ; yy = [ ymin , ymax ] ; % prices subplot ( 2 , 2 , 1 ) t = 0 : length ( Qs ) −1; p l o t ( t , P ) ; x l a b e l ( ’ t ’ ) ; y l a b e l ( ’P ’ ) ; y l i m ( yy ) ; % cobweb p l o t subplot ( 2 , 2 , 2 ) Pt = linspace ( ymin , ymax , length ( P ) ) ’ ; p l o t ( [ Qd_bar−a∗ Pt Qs_bar+b∗ Pt ] , Pt , ’−− ’ ) ; x l a b e l ( ’Q ’ ) ; y l a b e l ( ’P ’ ) ; y l i m ( yy ) ; hold on ; f o r t = 1 : length ( P )−1 p l o t ( [ Qs_bar+b∗P ( t ) , Qd_bar−a∗P ( t ) ] , [ P ( t ) ,P ( t ) ] , ’ r ’ ) ; p l o t ( [ Qd_bar−a∗P ( t ) , Qs_bar+b∗P ( t +1) ] , [ P ( t ) ,P ( t +1) ] , ’ r ’ ) ; end hold o f f O. Afonso, P. B. Vasconcelos

Computational Economics

21 / 26

Computational implementation

Cobweb plots % phase diagram ( p r i c e ) subplot ( 2 , 2 , 3 ) p l o t ( [ 0 , ymax ] , [ 0 , ymax ] ) ; yy = [ P ( 1 ) ∗ 0 . 9 5 , ymax ] ; hold on ; f o r t = 1 : length ( P )−1 p l o t ( [ P ( t ) ,P ( t ) ] , [ P ( t ) ,P ( t +1) ] , ’ r ’ ) ; p l o t ( [ P ( t ) ,P ( t +1) ] , [ P ( t +1) ,P ( t +1) ] , ’ r ’ ) ; end x l a b e l ( ’ P_ { t } ’ ) ; y l a b e l ( ’ P_ { t +1} ’ ) ; x l i m ( yy ) ; y l i m ( yy ) ; hold o f f % q u a n t i t i e s demanded and s u p p l i e d subplot ( 2 , 2 , 4 ) t = 0 : length ( Qs ) −1; p l o t ( Qs , t , ’− ’ ,Qd, t , ’−− ’ ) ; x l a b e l ( ’Q ’ ) ; y l a b e l ( ’ t ’ ) ; legend ( ’ Q_s ’ , ’ Q_d ’ ) ; end

O. Afonso, P. B. Vasconcelos

Computational Economics

22 / 26

Numerical results and simulation

--------------------------------------------------------Cobweb model --------------------------------------------------------Qd,t = 1000 - 10*Pt Qs,t = 250 + 5*Pt-1 Qd,t = Qs,t t Qt Pt 0 25.00 1 375.00 62.50 2 562.50 43.75 3 468.75 53.12 4 515.62 48.44 5 492.19 50.78 6 503.91 49.61 7 498.05 50.20 8 500.98 49.90 9 499.51 50.05 10 500.24 49.98 11 499.88 50.01 12 500.06 49.99 13 499.97 50.00 14 500.02 50.00 15 499.99 50.00 16 500.00 50.00 17 500.00 50.00 18 500.00 50.00 O. Afonso, P. B. Vasconcelos

Computational Economics

23 / 26

65

65

60

60

55

55

50

50

45

45

P

P

Numerical results and simulation

40

40

35

35 30

30

25

25 0

2

4

6

8

10

12

14

16

400

18

450

500

550

600

650

700

750

Q

t

(a) price dynamics

(b) Cobweb plot 18

65

Q

s

Qd

16

60

14 55 12 50

t

Pt+1

10 45

8 40 6 35 4 30 2 25 0 25

30

35

40

45 Pt

50

55

60

65

400

450

500

550

600

650

700

750

Q

(c) price phase diagram

(d) quantity dynamics

Cobweb plots O. Afonso, P. B. Vasconcelos

Computational Economics

24 / 26

Highlights

The cobweb is a dynamic model derived from the static supply–demand model. It assumes that supply reacts to price with a lag of one period of time, while demand depends on current price. It explains why prices might be subject to periodic fluctuations in certain types of markets. The market model with inventory relaxes the assumption that supply must equal demand. Difference equations are introduced and specifications about convergence are exposed.

O. Afonso, P. B. Vasconcelos

Computational Economics

25 / 26

Main references

A. C. Chiang, K. Wainwright Fundamental methods of mathematical economics. McGraw-Hill, New York, 2005. G. Gandolfo Economic dynamics. Springer, 2010. B. P. Pashigian Cobweb theorem. In Lawrence Blume and Steven Durlauf, editors, The new Palgrave dictionary of economics. Palgram Macmillan, 2008.

O. Afonso, P. B. Vasconcelos

Computational Economics

26 / 26