Vous êtes sur la page 1sur 13

Chapter 1

Useful to use excel when we have a small enough model Using a one-sector growth model (Ramsey) Brief description: Trade off b/w consumpion and investment Finite horizon, terminal capital stock constraint Key elements of the model: Production fn w/ capital as output, capital accumulation relationship (using investment to create new capital), utility function resulting from consumption
More consumption in a time period means more utility in that time period but less investment and therefore less capital stock and less production in future time periods.

Aggregate prod fn: Yt = Kt

Cobb-douglas Fn w/ just one variable Where is a technology parameter and is the exponent of capital in the prod fn

Capital accumulation relationship: Kt+1 = Kt + Yt Ct = Kt + Kt Ct


If Yt Ct is positive then it is investment, if it is negative then it is saving Then there's an initial condition, that initial capital K0 is given Terminal condition that fixes a min amount of K: KN K*

Criterion fn: U(Ct) =

1 * Ct (1- ) where is a parameter of the utility fn 1


N 1 t U (C t) t=1

The sum of discounted utilities will be: J =

Discounted value for the

utility obtained from consumption over all of the periods covered by the model, where the 1 = discount factor and is the discount rate. 1+ N 1 1 t ) Substituting the utility fn, we obtain: J = C t(1 1 t=1

So, summing up all this stuff, the problem should be stated as follows:
N 1

Find (C1, C2, C3, , CN-1) in order to maximize J = Subject to Kt+1 = Kt + Kt Ct K0 given KN K*

1 t C 1 t(1 )
t=1

This model is NON-LINEAR because of the criterion function J and of the capital accumulation equation. Remember also that when the discount rate is higher, future utility is discounted more heavily, that is given less weight in the criterion fn (see table)

The graph above illustrates how consumption changes over time wrt beta. (The higher the beta, the higher will be consumption in future years) Modifying theta, the efficiency of the production process changes in a directly proportional way. Modifying tau instead, we affect the curvature of the utility function or its degree of MU.

Chapter 2
In the neural networks model, we begin from observed behaviour and attempt to find parameters which permit to find the specified relationships to most closely fit the data. These models are suitable to deal with problem in which relationships between variables are not well-known and with data sets whose underlying non-linearities and not known in advance. Here we will apply the to finance, specifically to best predict future price of stocks. The central notion of neural net analysis is that we can use a set of observations from the past to predict future relationships. To predict a future company's stock price we will use stock prices of related companies: suppliers and competitors. Brief description: Neural networks are composed by three main elements: processing elements (called nodes or neurons), an interconnection topology and a learning scheme. It processes data through multiple parallel processing elements, which do not store any data or decision result. The network processing fn learn or adapt assuming specific patterns which reflect the nature of those inputs. We can see now the typical structure of a neural network:

The neuron, an elementary processing unit that generates output given inputs, is composed by two parts: a combination fn and an activation fn. The combination fn usually compute the net input as a weighted sum of the inputs, the activation fn computes output given the net input. The output is usually ranged from 0 to 1 using different functional form al logistic and sigmoid fns. Input layer neurons receive data (signals) from outside and in general transmit them to the next layer without processing them. Output layer neurons return data to the outside, and are sometimes set to apply their combination functions only. The learning process consist of choosing weights and this is doing by giving the model some inputs, comparing the output to a known target and then finding the right weights by computing the error and minimizing it. Specific example: The automobile stock market We begin by specifying the combination fn for the output layer:
q

Y t =+ tj where Yt is the output in period t, q is the number of hidden nodes, the atj 0 ja
are the hidden nodes values in period t and the 's are the parameters we are looking for. The atj are given by the expression: q 1 a tj = z = w jix it we have to find also the parameters wji, the xit are the inputs at node i 1+ e z i=1
j

j=1

It follows the shape of the function providing the atj: we can see that its range is from 0 to 1.

The objective fn of this model is the squared deviations from the predicted output and the actual output (where in this case the output is the automotive company stock price): This function in to be minimized by changing the parameters descibed before.

( y t )2 t
t =1

Where is the actual value of stock price and n is the n of observations

Chapter 4
Here the problem is about finding the most efficient place and manner of producing goods and shipping them to customers minimizing the transportation costs. We will use GAMS to find the pattern of shipments from 2 plants to 3 mkts. which will have the least transportation cost while satisfying the fixed demand at the markets without shipping more from any plant than its capacity. Math representation: We have 2 sets: I (plants) and J (mkts). We have to find the shipments from plants to mkts xij, such that the transportation cost z is minimized. Z=

cijx ij
iI jJ

where cij is the transportation cost per unit prom plant I to mkt j.

We have two constraints: the first relating to max capacities and the second relating to satisfying mkts' demands. (1) (2)

x ij aij jJ xij bij


iI

And of course all shipments must be non-negative.

GAMS representation: Here follow the code used in GAMS for the transportation model:
SETS I J canning plants markets / SEATTLE, SAN-DIEGO / / NEW-YORK, CHICAGO, TOPEKA / ;

PARAMETERS A(I) / B(J) / capacity of plant i in cases SEATTLE 350 SAN-DIEGO 600 / demand at market j in cases NEW-YORK 325 CHICAGO 300 TOPEKA 275 / ; TOPEKA 1.8 1.4 ; /90/ ;

TABLE D(I,J)

distance in thousands of miles NEW-YORK CHICAGO SEATTLE 2.5 1.7 SAN-DIEGO 2.5 1.8

SCALAR F

freight in dollars per case per thousand miles

PARAMETER C(I,J)

transport cost in thousands of dollars per case ;

C(I,J) = F * D(I,J) / 1000 ; VARIABLES X(I,J) Z shipment quantities in cases total transportation costs in thousands of dollars ;

POSITIVE VARIABLE X ; EQUATIONS COST SUPPLY(I) DEMAND(J) COST .. SUPPLY(I) .. DEMAND(J) .. Z define objective function observe supply limit at plant i satisfy demand at market j ; =E= SUM((I,J), C(I,J)*X(I,J)) ; =L= =G= A(I) ; B(J) ;

SUM(J, X(I,J)) SUM(I, X(I,J))

MODEL TRANSPORT /ALL/ ; SOLVE TRANSPORT USING LP MINIMIZING Z ; DISPLAY X.L, X.M ;

Rememer the order in which things must be put into: Set Parameters Variables Equations Model Solve.

One should first locate the Solve Summary part of the output. To do this search in the editor for the string "SOLVER STATUS".
S O L V E MODEL TRANSPORT TYPE LP SOLVER BDMLP **** SOLVER STATUS 1 **** MODEL STATUS 1 **** OBJECTIVE VALUE S U M M A R Y OBJECTIVE Z DIRECTION MINIMIZE FROM LINE 70 NORMAL COMPLETION OPTIMAL 153.6750

Each time after you solve a GAMS model you should check this section of the output to be sure that the model was solved successfully. The words NORMAL COMPLETION here indicate that is the case. If the solution procedure was not successful you will find words like INFEASIBLE or UNBOUNDED. Be on guard against the fact that the GAMS output will provide a solution to the model even when that solution is infeasible. However, the solution provided would not be the optimal solution but rather the last one tried before it was determined that the solution was infeasible.

Chapter 6
This model helps us to simulate a student's personal financial situation. We will use GAMS to solve the problem of minimizing the squared separations b/w the desired paths of savings and consumption and the optimal paths. Mathematics of the model: Let's first define the assets and liability account by denoting the states, the x's:

xt =

[]
Sb Se Sc Scc Ssl
n states / Sb, Se, Sc, Scc, Ssl / m controls / Xbe, Xbc, Xbcc, Xbsl, Xec, Xecc, Xesl, Xcacc, Xcsl, Xccsl / k exogenous / Wa, Le, Sh / t horizon / 2000, 2001, 2002, 2003, 2004 / tu(t) control horizon ti(t) initial period tz(t) terminal period ;

Where the Sb is the stock of bonds, Se of equity, Sc of the checking account, Scc of the credit card, Ssl of the student loan. Then we have the control variables, the u's, that indicate the transfers from one a/c to another and can be positive or negative depending on the direction of the transfer. We can find also the exogenous variables: Wa (wages), Le (living expenses) and Sh (scolarship). Here follows the GAMS code, where we can see all the formulas used and the mechanics of the problem.
Sets

Alias (n,np), (m,mp) ; tu(t) = ti(t) = tz(t) = Display yes$(ord(t) lt card(t)); yes$(ord(t) eq 1); not tu(t); t, ti, tz, tu; state vector matrix Se 1.10 Sc 1.01 1.13 control vector matrix Xbc -1 1 Xbcc -1 -1 -1 Xcacc -1 -1 Xcsl -1 -1 Xccsl Xbsl -1 Xec -1 1 Xecc -1 -1 -1 Xesl -1 1.04 Scc Ssl

Table a(n,np) Sb Se Sc Scc Ssl Sb 1.05

Table b(n,m) Sb Se Sc Scc Ssl + Sb Se Sc Scc Ssl Xbe -1 1

1 -1

Table c(n,k) Wa Sb Se Sc Scc Ssl 1

exogenous vector matrix Le -1 Sh 1

Table w(n,np) Sb Se Sc Scc Ssl Sb 100

state vector matrix penalty matrix Se 100 Sc 400 200 0 Scc Ssl

Table wn(n,np) Sb Se Sc Scc Ssl Sb 200

terminal state vector matrix penalty matrix Se 200 800 200 1 Sc Scc Ssl

Table lambda(m,mp) lambda matrix

Xbe Xbc Xbcc Xbsl Xec Xecc Xesl + Xcacc Xcsl Xccsl

Xbe 20

Xbc 1

Xbcc 20

Xbsl

Xec

Xecc

Xesl

20

20 20 20

Xcacc 1

Xcsl 1

Xccsl 20

Table xtilde(n,t) 2000 Sb Se Sc Scc Ssl 1000 2000

state vector desired paths 2001 1000 2000 2002 1000 2000 2003 1000 2000 2004 1000 2000

Table utilde(m,t) Xbe Xbc Xbcc Xbsl Xec Xecc Xesl Xcacc Xcsl Xccsl 2000

control vector desired paths 2001 2002 2003

Parameter xinit(n) initial value Sb 4000 Se 0 Sc 1000 Scc 0 Ssl 0 / Table z(k,t) Wa Le Sh 2000 15000 20000 0 exogenous variables 2001 15000 20000 0 u(m,t) j x(n,t) 2002 15000 20000 0

2003 15000 20000 0

2004 15000 20000 0

Variables Positive Variables Equations criterion stateq(n,t) criterion..

control variable criterion ; state variable ;

criterion definition state equation ;

j =e= .5*sum( (tz,n,np),(x(n,tz) - xtilde(n,tz))*wn(n,np)*(x(np,tz) xtilde(np,tz)) ) + .5*sum( (tu,n,np),(x(n,tu) - xtilde(n,tu))*w(n,np)*(x(np,tu) xtilde(np,tu)) ) + .5*sum( (tu,m,mp),(u(m,tu) - utilde(m,tu))*lambda(m,mp)*(u(mp,tu) utilde(mp,tu)) ) ; stateq(n,t+1).. x(n,t+1) =e= sum(np, (a(n,np)*x(np,t))) + sum(m, (b(n,m)*u(m,t))) + sum(k, (c(n,k)*z(k,t))); Model track /all/; x.fx(n,ti) = xinit(n); Solve track minimizing j using nlp; Display x.l, u.l;

Chapter 8
Input-Output model
In this model we consider an economy with three industries (1, 2 and 3). Each of them produces a single output, using as inputs part of its own production as well as part of the output from the other. Each industry plays a dual role since it is both a supplier of inputs and a user of outputs. Imagine that each product in this economy is also used to satisfy external demand. The economy can be represented by the following linear system of equations:

x 1=a11x 1+ a12x 2 + a 13x 3+ d 1 Where the x's are the production levels for each industry, the aij x 2=a 21x 1+ a 22x 2+ a 23x 3+ d 2 are the input-output coefficients (the intermediate requirement x 3=a31x 1+ a 32x 2+ a 33x 3+ d 3 from industry I per unit of output of industry j) and the d's are the final demand
It can also be written more simply in matrix notation:

x= Ax+ d
Here it is the GAMS statement:
SCALARS d1 final demand for x1 d2 final demand for x2 d3 final demand for x3 /4/ /5/ /3/; 1 2 3 set upe the fake optimazation problem;

VARIABLES x1 production level industry x2 production level industry x3 production level industry j performance index used to

EQUATIONS eqx1 eqx2 eqx3 jd performance index definition always a fake; jd.. j =E= 0; eqx1.. x1 =E= 0.3*x1 + 0.2*x2 + 0.2*x3 + d1;

eqx2.. x2 =E= 0.1*x1 + 0.4*x2 + 0.5*x3 + d2; eqx3.. x3 =E= 0.4*x1 + 0.1*x2 + 0.2*x3 + d3; MODEL IO /jd, eqx1, eqx2, eqx3/; SOLVE IO MAXIMIZING J USING LP; DISPLAY x1.l, x2.l, x3.l;

As we can see we had to add a fake criterion function, j, because GAMS optimize but has not procedures to solve the model by solving simultaneous equations. We thus cheat, by inserting a function that has to be maximized but it actually has nothing to do with the model itself, just to make GAMS capable to solve the linear system.

Production prices model


This model is a non-linear model in which prices have to be determined given technology and a distributive variable. One of the main goals is to study issues of income distribution b/w wages and profits. We define as: v = value of intermediate inputs = profits w = wage cost p = price So that: v + + w = p. We also assume that profits are equal to a profit rate, r, times v: = v*r And we obtain: v*(1+r) + w = p. We then use the input-output coefficients for intermediate inputs and for wages:

(a 11p 1+ a 21p 2+ a 31p 3)(1+ r)+ l 1w= p 1 (a 12p 1+ a 22p 2+ a32p3)(1+ r )+ l 2w= p2 (a 13p 1+ a 23p 2+ a 33p 3)(1+ r)+ l 3w= p 3
The a's have the subscripts reversed wrt the previous model because they're the transposed matrix A because here we determine prices given technology and in the input-Output model we determined quantities given technology. The l's are also input-Output coefficients indicating the quantity of labor required for the production of one unit of product. W is assumed to be uniform for the whole economy and r is the same for every industry otherwise there would be capital movement from industries where r is tow to industries where the rate is higher. Since all prices are relative we need to choose one in order to express al the others in terms of it. We can do this by fixing one price and to deal with the degree of freedom wrt w and r we should fix w, for example, too. Here is the model in GAMS:
SCALARS L1 /0.2/ L2 /0.5/ L3 /0.3/; VARIABLES p1 p2 p3 w r

performance index;

EQUATIONS eqp1 eqp2 eqp3 jd performance index definition; jd.. j =E= 0; eqp1.. (0.3*p1 + 0.1*p2 + 0.4*p3) * (1+r) + L1 * w =E= p1; eqp2.. (0.2*p1 + 0.4*p2 + 0.1*p3) * (1+r) + L2 * w =E= p2; eqp3.. (0.2*p1 + 0.5*p2 + 0.2*p3) * (1+r) + L3 * w =E= p3; r.fx = 0; p1.fx = 1; MODEL PP1 /all/; SOLVE PP1 MAXIMIZING J USING NLP; DISPLAY p1.l, p2.l, p3.l, w.l, r.l;

It is interesting to see what happen as r changes:

We can note that there is an inverse relationship b/w w and r. In this example, not only wages, but also prices go up as r decreases. However, in general, prices can go either way - some may go up, others down. However, if we choose w as the numeraire, we will observe that as r increases, all prices increase, indicating that he real wage will decrease no matter the weights used to compute the corresponding wage deflator.. (The wage deflator is the wage divided by the price of 1 good).

General equilibrium model


Here we move to a model in which quantities and prices are determined simultaneously. One of the main goals is to study the change in prices and quantities when technology, preferences or endowments changes. We have a very simple economy with just one production sector, two factors of production and a single household. The prod sector produces a single good qs, with a Cobb-Douglas constant returns to scale prod technology using two inputs: labor and capital. Technical progress (b) can affect total factor productivity. The labor and capital demand function ld and kd are derived combining the prod fn with the assumption of profit max behaviour. Labor and capital supplies ls and ks are given exogenously. The household provides labor and capital in exchange for the corresponding wage w and profit r, spending all his income y, in the demand for the single good qd. Three mkts (labor, capital and good) and supply=demand.

Equations:

q s=b(l d )a k d )(1a) prod fn; ( l d= (aq sp) w


labor demand;

l s= l s l s=l d

labor supply; market clearing condition.

*** To obtain the expressions for ld and kd : Max s.t --->

pq swl d rk d =

q s=bl ak (1a) d d p dk d = (bl


a (1a)

)wl d rk d

The first order conditions are:

( ) = (d ) l ( ) = ( d ) k

pabl d

(a 1 )

k d

(1a )

w = 0

a a p 1a )bl dk d r = 0 (

Substituting the production function into I and II and rearranging terms we obtain, respectively, the labor and capital demand functions ld and kd.****
Kd =

(( 1a )qs p) capital demand r

k s=k s capital supply


ks = kd Market clearing condition y = wld + rkd qd = household income

y p

good demand

qd = qs good market clearing condition This simple model has 10 variables and 10 equations .However, one of them is redundant, since Walras law establishes that for n-markets we need n-1 equilibrium conditions only. We thus choose one price as the numeraire in order to express all other prices in terms of it. Plus we delete the good market clearing condition. Here follows the GAMS code:
SCALARS a labor share / 0.7 /

b technology parameter / 1.2 /; POSITIVE VARIABLES qs good supply qd good demand ld labor demand ls labor supply kd capital demand ks capital supply p price w wage r profit y income; VARIABLES j performance index; EQUATIONS eqs good supply equation (production funcion) eqd good demand equation eld labor demand equation els labor supply equation ekd capital demand equation eks capital supply equation ey income equation eml labor market clearing emk capital market clearing jd performance index definition; jd.. eqs.. eld.. els.. eml.. ekd.. eks.. emk.. ey.. eqd.. j =E= 0; qs ld ls ld kd ks kd y qd =E= =E= =E= =E= =E= =E= =E= =E= =E= b * ld**a * kd**(1-a); a * qs * p / w; 2; ls; (1-a)* qs * p / r; 1; ks; w * ld + r * kd; y / p;

*lower bounds to avoid division by zero p.lo = 0.001; w.lo = 0.001; r.lo = 0.001; *numeraire p.fx = 1; MODEL SIMPLEGE /all/; SOLVE SIMPLEGE MAXIMIZING J USING NLP; DISPLAY qs.l, qd.l, ld.l, ls.l, kd.l, ks.l, p.l, w.l, r.l, y.l;

We have to verify that supply=demand in each market. We can note also that when the value of the numeraire increase, all quantity vars should remain the same while nominal vars (price and income) should increase proportionally. Money in this model is not explicited, so we can consider it as a model of the real side of the economy: the result of the change in the numeraire can be interpreted as money to be neutral in this model.

Vous aimerez peut-être aussi