Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
SESSION 4 - SPREADSHEETS 2: MODEL BUILDING AND DYNAMICS In this lecture you will learn: - how to use Excel for reproducing economics models - how to use Excel for representing simple dynamic relationships in economics Before we start… Demo 3.6 Another very important class of non-linear functions widely used in economics is the logarithm. Here we will demonstrate how to take logs (using =Ln(..)) and how to take anti-logs (using =exp(..)). For an example of the calculation of the natural log and the log to base 10 of x click here An important application of logs in economics is to represent exponential functions, particularly production functions and utility functions. For example, the production function in demo 3.5 can be transformed into an equation that is linear in logarithms, namely log (y) = log(A) + a*log (L) + b*log(K). This makes it much easier to incorporate non-linear formulations in simple models. 4.1 Building models Excel is a very good tool for building all kinds of models. In this session we will look at some simple models from economics to illustrate how to set about the job. In essence most models can be broken down into a few basic relationships, represented by formulae. Building a model therefore starts with the process of identifying these relationships and building a superstructure around them. To illustrate, suppose we know that a firm's cost function is C = 2 + 4x and that it faces demand of p = 20 - 4x where p is price charged, x is output and C is cost. In order to find the firm's profit maximizing output we could just find marginal cost and set it equal to marginal revenue. Alternatively, we could set up a worksheet to illustrate the firm's decision problem. The advantage of the latter is that we could use the same worksheet to explore changes we might want to make, such as changing the cost function, imposing a tax on the product and so on. When building even simple models like this it is good idea to get into the habit of setting out the worksheet in a way that makes it self-explanatory to other viewers. Adding notes to the worksheet is quite a useful idea: click here for demo 4.1 4.2 Parameter Boxes and Absolute Addresses A very good idea, when you are building models of things like production functions or simple cost functions, is to set up the worksheet in a way that gives you some control over the values used in functions. This enables you to simulate the effects of changing constants or 'parameters'. In the previous example you might want to change the values of any or all of the cost and demand parameters to see what effect this has on the quantity of output produced. To do this you need to design the worksheet so that there is a place where you set initial values for parameters as well as a table where the calculations are done. In order to do this you need to make use of the idea of an absolute address. Normally in Excel cell references are relative, so that when you copy from one cell to another all references adjust automatically. For example suppose you have a set of values for x in A2:A12 and a formula relating y to x you want to calculate in B2:B12. By putting the formula in B2 and referring to the value in A2 you can calculate the value of y for B2. You can then just copy the formula down the column. An absolute address, by contrast, is a reference that is not adjusted automatically when you copy. To indicate an absolute address you use the $ sign. You can 'lock onto' a row and/or a column by using the sign in front of the row and/or column reference. Thus $A14 will always refer to column A while the row reference varies in the usual way. To fix on a single cell you need the $ sign in front of both row and column address e.g. $D$5. To experiment with this, start a fresh spreadsheet and put some figures in A1:B3 1 2 3 A 3 5 7 B 4 6 8 Now go to C1, enter =A1 and copy it to C1:D3 You should get a copy of the entries in A1:B3 But what happens when you enter =$A1 in C1 and copy to C1:D3 in the same way? See how the copy process ‘fixes’ column A address but the row is relative The column becomes an absolute Now try entering =A$1 in C1 and see how it ‘fixes’ row 1 when you copy to C1:D3. In this case the row address is absolute and the column is relative Finally enter =$A$1 in C1 and copy it to C1:D3. You have now fixed both row and column, so you are just copying the absolute row and column address of cell A1. Make sure you can understand this before continuing. A parameter box exploits the use of absolute addresses by allocating to the box any values that are to be used only temporarily as constants. To illustrate, our next example is a reworking of demo 4.1 above: click here to see demo 4.2 . Again, check that you understand what the $ characters are doing in the formulae. 4.3 Growth and Dynamic Models In many economic models there is a dynamic element, and it is of interest to track variables through time. This may involve 'real' time periods, e.g. 1998,1999, 2000 and so on. Or it may involve setting a time counter where your model starts in period 0 or 1 and then runs forward to periods 2,3,4,5 and so on (especially theoretical models). The best way to set up worksheets for models of this kind is to follow some basic rules, in particular: 1. Use the first column for entering time, whether as a date, a time period or whatever 2. Use a parameter box for any assumptions you are going to make, e.g. about growth rates or relationships between variables, so that you have the capacity to alter them later 3. Pay particular attention to the first two or three rows in the tables you set up, making sure that any starting or initial conditions are spelled out appropriately 4. Be clear about the distinction between stocks and flows (e.g. between wealth and income) and ensure that any stocks are linked through in such a way that one period's closing stock becomes the opening stock for the following period 1. A simple growth model In the simplest case there is a single variable that grows steadily through time. The mathematical structure of these models takes the form: x(t) = [1 + g] * x(t-1) where x indicates a variable, the t indicates the period in which it is evaluated and the growth factor is denoted by g, which is growth expressed as a decimal (e.g. 0.05 for a growth rate of five per cent) A simple example would be tracking the time path of National Income when it is projected that there will be economic growth at some steady rate. With a growth rate of 5% this is equivalent to setting x(t) = [1+.05] * x(t-1). The strategy for building models with this kind of structure is to begin with a column in which a time counter runs and to track other variables in relation to this time index. In demo 4.3., National Income is assumed to start at 1000 and to grow at a steady rate of 5% per annum (Sheet 1) or 8% (Sheet 2). 2. A weighted average model In a slightly more complicated case the behaviour of a single period during time period t depends in some way on its own past behaviour. It might, for example, be a weighted average of its own previous two values, as shown in demo 4.4. The mathematical structure of these models more generally takes the form: x(t) = a1 *x(t-1)+a2* x(t-2)+a3*x(t-3)+ ,...aj*x(t-i), where the constants aj sum to 1. The pattern these constants are assumed to follow can take many forms. Convenient examples include uniform weights and weights decaying exponentially. 3. A cobweb model More generally still, behaviour of a variable in time period t may be related to past values of both itself and other variables. As long as the structure of the relationships is known, it is fairly straightforward to build spreadsheet models to illustrate the dynamics of such processes. An example is the Cobweb Model. A market has a supply side in which producers have to anticipate market price when making the production decisions that will determine supply in the following period. Examples might be farmers deciding how much of a crop to plant or housebuilders deciding how many new dwellings to build. In a simple Cobweb Model, it is assumed that producers use a naive approach to form price expectations. They assume that next period's price will be equal to this period's. To be more precise the producers set supply according to the schedule: S(t) = 10 + 0.15*p(t-1) The market demand for the product is given in relation to current market price by: D(t) = 70 - 0.8*p(t) The market adjusts via price to ensure that supply is equal to demand within each time period. This price can be deduced from the equilibrium condition as follows: S(t) = D(t) => 10 + 0.15* p(t-1) = 70 - 0.8* p(t) From this it is possible to write down an expression for this period's price (which is endogenous, or calculated within the model) in relation to the previous period's price (which is predetermined outside the model, or exogenous): p(t) = (70 - 10 - 0.15*p(t-1))/ 0.8 This is nearly sufficient to solve the model. The remaining step is to specify an initial price level in order to 'get things going'. Assume that in period zero, price was equal to 100. Now set the model up in worksheet format. The best way to do it is to use three columns (for time, price and supply respectively) and to put the values of the supply and demand parameters in a section to the side. By keeping the parameters 'live' it is possible to change them and see at a glance how the model changes with supply and demand conditions. Do this by keeping text (such as 'a', 'b' etc) in a different cell from the value (10, .15 etc.). When building your table ensure that you refer to absolute addresses (using $ signs) rather than relative addresses. See demo 4.5. 4. A Multiplier-Accelerator Model In macroeconomics it is quite common to find dynamic models in which analysts relate behaviour in period t to one or more events in period (t-i) or earlier. Economic cycles can be generated by processes of this kind involving time lags. A good example is the multiplieraccelerator model in which an interaction occurs between the savings side of the economy and the investment decisions made by corporations. The model has the following form: Aggregate consumption in period t, denoted C(t), depends on current income, denoted Y(t), according to the consumption function C(t) = 0.8Y(t) The level of investment in the economy, denoted I(t), depends on the rate at which income is increasing since a higher level of output requires investment to raise the stock of capital available. Investment is assumed to be equal to ¾ of the change in GDP since last year: I(t) = 0.75[Y(t) - Y(t-1)]. Autonomous spending by others including the government A(t) = 500 ‘Autonomous’ spending is just a number determined outside the model. Aggregate demand in this economy, denoted AD(t), is given as the sum of spending by consumers (C(t)), plus investment spending by firms (I(t)) plus autonomous spending by others (e.g. government). AD(t) = C(t) + I(t) + A(t) Output in the economy in period t is determined by aggregate demand in the previous period, so that Y(t)=AD(t-1). That is to say that output adjusts to demand with a lag of one period. A spreadsheet version of this model is to be found in demo 4.6. Production Function example Now that you are more familiar with Absolute Addresses, you may be interested to see the solution of last week’s Ex 3.7. 4.4 References Chapter 4 of Judge has a section (4.7) on dynamic models. An example (Practical 4.11 on page 137) in the text illustrates a simple 'multiplier-accelerator' model that is very similar to demo 5.6. Chapter 10 of Bradley and Patton is concerned with Difference Equations. Section 3 of the chapter includes a dynamic macro model (example 10.7) and a cobweb model (example 10.8). Class Exercise 4 can be found here