## Info

applied work.68 However, it is important that business economists evaluating demand at least consider the foundations for specifying the equation in a certain fashion.

Linear Demand Model: This is the simplest model and the one most likely represented in textbooks. It also has the weakest theoretical basis. However, under certain limited conditions it is the most practical.

The most basic linear model is of a familiar form: x=a+bp¡

Most analysts should include relative prices and income, using this form:

Semi-Log Demand Model: A variation of the linear-in-the-logs model described above is: ln(x)=a+by+c(pjp)

Other Demand Models: There are a variety of other specifications for demand functions using logs, semi-logs, powers, rational, and other combinations. The Curve-Fitting Toolbox provides a straightforward manner of specifying and estimating multiple versions. The conditions mentioned under "Practical Basis for Linear Demand Models" on page 101 are likely to hold true as useful approximations of reality.

Directly Specified Demand Models: In many cases, you will have a prior knowledge, often from previous research, that suggests a specification of a demand model. Consider carefully whether the previous analyses were based on data that are actually comparable to the market participants you are modeling and, if not, make allowance for behavior to be different.

Practical Basis for Linear Demand Models

The practical and theoretical basis for a linear demand equation is based on the following:

1. The observed demand is usually not of individual consumers but of a large number of aggregate consumers. Therefore,

68 For example, it may be important to compare consumer demand for certain goods over time or across different data sets, specifications, and estimation techniques. A well-thought-out analysis will allow such comparisons and provide the analyst with the ability to compare his or her results with those of others.

restrictive utility functions used in microeconomic theory for individual consumers are not the direct underpinnings of models of aggregate consumer demand. This allows the demand functions for aggregate consumers to be modeled as if there were a large group of consumers for whom there is a continuous demand function.6 This is especially appropriate when studying demand for a narrow product category targeting a narrow class of consumers.

2. Given the large number of different factors that affect numerous consumers, an appeal may be made to the central limit theorem to justify an assumption of normal errors when estimating such an equation.70 Note that such an appeal requires a large sample size or other information on the distribution of small-sample variables.71

3. Although the underlying demand function of aggregate consumers is probably not linear, the observed range of data may be approximated by a linear function which may include variables that are products, logs, or other combinations of other variables.72

4. In practical applications, the relative price can be approximated by deflating the nominal price by a general price index,73 and the

69 An extensive discussion, including mathematical derivations, is in A.Mas-Collell, M.D.Whinston, and J.R.Green, Microeconomic Theory (New York: Oxford, 1995), Chapter 4. See also H. Varian, Microeconomic Theory, 3rd ed. (New York: Norton, 1992), Chapter 9.4, "Aggregating across Consumers."

70 The central limit theorem is one of the most important in statistics and econometrics. It may be summarized as: the distribution of the mean of a very large number of independent random variables converges to a normal distribution. See, e.g., G.W.Snedecor and W.G.Cochrane, Statistical Methods, 8th ed. (Iowa University Press, various editions 1937-1989), Section 7.8.

A more careful mathematical derivation builds from the sample of any distribution with a finite mean and variance; almost all economic and business variables of interest satisfy this quality. The theorem holds that, if Xj are the members of a random sample from a distribution with a mean p and positive variance a2, then the random variable ¡7 where n is the sample size, and A'is the sample mean of the Xi, has a limiting distribution that is normal, with mean zero and variance one. See R.V.Hogg and A.T.Craig, Introduction to Mathematical Statistics, 4th ed. (New York: Macmillian, 1978), Section 5.4.

71 As the name implies, the central limit theorem describes the limiting distribution of a sample of variables. It does not mean that a small sample of variables about which we know very little is distributed normally.

72 The desirable properties of standard ordinary least squares estimators for the parameter vector p in the standard model Y=Xp+s will still hold when the expectation of the dependent variable Y, E(Y), is linear in the unknown parameter p. This allows for cases where the explanatory variables X can be the natural logs of other variables or even products or powers of other variables. For a discussion of these and other practical applications of the linear model, see H. Theil, Principles of Econometrics (New York: John Wiley & Sons, 1971), Section 3.9, "Limitations of the Standard Linear Model."

73 Be careful not to indiscriminately use the U.S. CPI, which has a well-known tendency to exaggerate underlying price inflation due to a persistent substitution bias and an overweighting for many consumers in energy prices and housing costs.

budget constraint can be relaxed when the price of the commodity is very small relative to overall income.74

General Cautions on Estimating Equations

Always consider the following cautions when specifying and estimating equations in an economic model such as a demand equation:

1. Microeconomic theory is based on well-behaved utility functions. These utility functions and other axioms typically prohibit purchases of negative quantities or negative prices, ensure consumers live within a budget constraint, prefer more to less, and like to pay less rather than more. A model should not violate those assumptions unless there is a good reason to believe that ordinary axioms do not apply.

2. Note that many models fail to follow a number of the assumptions listed above. In particular, linear models will allow negative prices and quantities; models that do not include income ignore the budget constraint; and use of nominal prices (especially with time-series data) violates the assumption that relative prices are the basis for consumer choices. You may be able to confidently use a model that, across all real numbers, violates one or more assumptions. One may do so only if the data and theory strongly support the model, the data are well outside the implausible range, and the range of the model is restricted.

3. The fact that data can be loaded into a regression model and the model is estimated with high "goodness-of-fit" statistics (such as R) means very little. It is much better to use a model for which there is strong theoretical and practical support than to simply run regressions until good results are obtained. It is occasionally useful to remind oneself that "correlation is not causality".75

4. If demand is based on multiple variables and a model is made using only one, then the model is misspecified. There may be serious consequences to this, including the estimation of parameters

74 This is especially true when using cross-sectional data. For time-series analysis, changes in income are quite important, as is deflating for price changes and taking into account other significant changes (such as taxes) that affect disposable income after purchase of essential commodities.

75 The prevalence of easy-to-use statistical software is, in this sense, a bane to solid thinking. I recall the pioneering University of Michigan econometrician Saul Hymans showing me how a single linear regression equation could be estimated, laboriously, using a desk calculator. He noted that, in times when such labor was required, economists thought very carefully about their model.

that are biased..76 Furthermore, omitting variables from an equation when such variables are observed by the market participants and affect their behavior will typically result in biased estimates.77 There are econometric techniques that sometimes minimize the effect of such biases. However, it is much better to properly specify the model in the first place. Again, excellent goodness-of-fit statistics provide no benefit when the "fit" is biased. 5. Consider the measurement accuracy of your variables and whether any of them include a certain amount of random error. Any error in the dependent or independent variable results in the estimated parameter having higher variance. In general, standard econometric techniques continue to work well when the explanatory variables in a regression equation have a certain amount of randomness, as long as the random behavior is not correlated with that of the dependent variable. However, when that randomness is correlated with the behavior of the dependent variable, the resulting estimates are most likely biased.78

Step Three: Model Demand Equation

Using the data and estimation results from the previous two steps, we can model consumer demand for a specific commodity. MATLAB provides a number of methods, the most general being the creation of a function.

Demand function: We can program a MATLAB function to calculate demand based on one or more inputs.

For example, the following function produces a demand schedule for a commodity, using a single (price, quantity) pair and one additional parameter (slope of the demand curve). The linear demand curve used by this function and illustrated in the graph it produces is very simple. Most

76 Bias in parameter estimates means that the method systematically produces an estimate that differs from the actual value. An unbiased estimate will still usually differ from the underlying value—it is, af ter all, an estimate—but has the desirable property of having an expected value equal to the actual value. A related concept is consistency, which applies to estimators that, as the sample size increases, are expected to converge to the actual underlying value. Estimators that are both biased and inconsistent, therefore, must be expected to provide the wrong answer no matter how much data is available. See the following notes for further explanation.

77 For example, Varian shows how estimating production using one variable—when another, omitted variable is also important and observed by producers—can result in overestimating the effect of the included variable. This effect can occur in estimating returns to education (because education is chosen by the same person who is earning the returns to it) and other phenomenon. See H.Varian, Microeconomic Theory, 3rd ed. (New York: Norton, 1992), Section 12.7.

78 In the standard linear model Y=a+pX+s, the assumption that X is nonstochastic can be relaxed and still retain the desirable properties of the ordinary least squares estimators if X is independent of the error term s. However, if the error term and X are correlated—as often happens in misspecified equations and correctly specified systems of simultaneous equations—the least squares estimators will be biased and inconsistent. See, e.g., J.Kmenta, Elements ofEconometrics (New York: Macmillan, 1971), Section 8-3. FIGURE 5-1 Linear demand function.

applications will require a more sophisticated demand function. However, it shows how demand can be modeled with a function within MATLAB and then illustrated with a graph.

See Figure 5-1, "Linear demand function," Code Fragment 5-1, "Simple Linear Demand Function," on page 120.

### Supply Function

We can also model a supply schedule. A MATLAB function for this is printed in Code Fragment 5-2, "Supply Function" on page 122. The function takes as arguments a price for a supplied quantity, an elasticity of supply, and a minimum price at which producers will supply goods or services. FIGURE 5-2 Supply schedule.

The function produces the quantity supplied for the price (which may be zero if it is too low) and a structure that contains the input parameters, plus the complete supply schedule.

The function also graphs the schedule, as illustrated in Figure 5-2, "Supply schedule." Finally, it includes a graphical comparison of the schedule, the elasticity parameter, and the actual arc elasticities at each interval. See Figure 5-3, "Elasticity of supply schedule."

Desirable Qualities of the Supply Function

This particular supply function is interesting and can be applied directly to many real-world problems. In particular:

• It has a "nearly constant" price elasticity of supply, as described in the next section, which is defined by a single parameter.

• It explicitly incorporates a minimum price (below which producers will not make new product) and makes the supply very sensitive to this initial price. FIGURE 5-3 Elasticity of supply schedule.

• It allows the user to vary the price elasticity of supply.

• The function itself is written in a modular fashion. The actual program itself is very short. The program relies on subfunctions that handle the work and graphics.

• The function returns a data structure which records useful information about assumptions and data produced from the function. This makes it easy to record information from a session for reviewing later.

### Elasticity of Supply

We derive the price elasticity of supply for this function below. A similar derivation can be used for demand and supply functions with similar forms.

The basic supply function expresses the quantity demanded as a function of price. We include an explicit minimum-price argument to the function and transform it into an inverse function in which price is determined from quantity, an elasticity parameter, and the minimum price parameter: p=qk+pmin from

qk=p-pmin

Differentiating with respect to quantity:

 3- = k £ = k ( Jh 1 P \ P; .P)

Recalling from the equation above the definition of cf and substituting it in:

dp M

Thus, the elasticity simplifies to the parameter k multiplied by a factor that, as prices grow, converges to one. For a good part of the usable range of the function the factor is slightly less than 1, so the elasticity of the schedule is slightly less than the elasticity parameter used in the function.79 This is illustrated in the lower panel of Figure 5-3, "Elasticity of supply schedule."

### Putting It Together

Once you can model supply and demand, you can attack many of the problems in typical economic thinking in a rigorous manner. For example, you can put them together as in Figure 5-4, "Demand and supply graph."

79 This is sensitive to the range of plotting and the minimum price. If the minimum price is large relative to the range used for plotting, the elasticities in that range may be significantly lower than the elasticity parameter.

Library functions for business economics 95 Supply and DtmjnO

Library functions for business economics 95 Supply and DtmjnO FIGURE 5-4 Demand and supply graph.

quality

FIGURE 5-4 Demand and supply graph.

### Graphics Techniques

The vast graphics capabilities of the MATLAB environment make it especially attractive for the business economist. MATLAB'S Handle Graphics allows the experienced user to control almost every aspect of a graphic from the figure window to the axes, lines, annotations, and the tick marks.

However, that power has its price. The price in the case of MATLAB graphics is complexity. While most basic graphs can be created quickly, graphics ready for final production or publication will normally require specific instructions.

We provide numerous examples of graphics in this book, often with the m-file code to generate the graphic. A systematic discussion of graphics is in Chapter 17, "Graphics and Other Topics," on page 421. That chapter includes a discussion of the principles of graphical excellence, in "Tufte Principles" on page 421; a script m-file that generates a set of sample graphics in "Methods of Specific Plots" on page 427. This testplot.m file is included in the companion Business Economics Toolbox.

### Libraries in Simulink

In addition to creating a library of MATLAB functions and scripts, you can also create libraries of blocks for use in Simulink. As business economists are likely to repeatedly use similar tools, the creation of specialized blocks can greatly speed up building and testing models.

We have created a small library of Simulink blocks which we use in the models described in this book. The following is a step-by-step procedure for establishing a business economics library into which you can place blocks developed by us, as well as your own blocks.80

### Set Up a Library

From the Simulink model browser, use the File|New|Library command. A new library window will open. Save the library file, preferably in a "library" folder where you keep your other MATLAB files. For example, you might save a BusEconUser library.

### To Put Blocks in the Library

Copy blocks from other models into the new library. If you are permanently adding blocks from other libraries, you must break the link to the existing model or block library in order to have a separate block saved in the library you are editing.81 Many frustrating difficulties are caused by not saving the blocks in this manner, including "unresolved library link" errors.

### Making the Library Appear in the Simulink Browser

Find the m-file slblocks.m and copy it to a folder in your path.82 I suggest creating your own Library or Tools folder to keep it separate from folders installed by MATLAB automatically.

80 As always, the instructions here are based on the software version available at the time of writ ing; check the user guide or help for later version.

81 Try right-clicking on the block and looking under the "link options" submenu, or use an Edit |Break Library Link command. Refer to the Simulink user guide or help documents for additional information.

82 There may be multiple files of this name, which can be found with the ('slblocks.m', 'all') command.

You can edit the slblocks.m file to make reference to the file name and screen name you select, or you can use Code Fragment 5-3, "Declaring An Economics Block Library," on page 127 as a template.

Troubleshooting Libraries

If you have unresolved library links or other difficulties, try the following steps:

1. Check to ensure that the slblocks.m file exists and correctly identifies your library files.

2. Carefully review the source of each block and the referencing of it by MATLAB.

See the Simulink user guide, the help files, or MathWorks solution 9009 for additional information.

### Modifying an Existing Library

You can add blocks, edit the ones in the library, and otherwise modify a library once you have created it. To edit existing blocks, you must unlock the library before editing and then save it afterwards. Be careful when editing a library block, as the changes you make will then apply to other blocks that are linked to it and may appear in other models. In such cases, you may wish to preserve a legacy block and create a new one with a different name.

### Special Library Blocks

Simulink comes with a wide array of functions, operators, signal generators, and other building blocks of a simulation model. Some of these are commonly used in business economics work. These are described below.

### Blocks for Growth Models

Typically, one models a market by first identifying the current state of affairs and then allowing key variables to change. We discuss in this section techniques for describing the initial state, as well as for causing changes in that state.

### Economic Base Series

We often start an analysis by assuming that consumers are spending a certain amount a year on a specific commodity, or that income is growing at an underlying rate, or that interest rates are trending to the sum of the inflation rate, plus a "real" component.

This is straightforward in Simulink, using a combination of blocks that are incorporated in the program and with blocks that are customized to perform specific calculation. The key blocks included with the program are described below. Custom blocks are described in the following section, "Custom Business Economics Blocks."

Constants

A constant block is included in Simulink. You can reference a number (e.g., 9) or a variable for which you have defined a number (e.g., sales2000).

Ramps

Simulink has a ramp block that quickly creates a series that starts at a certain number and grows linearly after that.

### Periodic Signals

Simulink has an enormous capability for creating complex periodic signals. Blocks that create such signals include sine wave, signal generator, repeating sequence, and pulse generator.

### Clocks

There are two clock blocks that generate time signals, which can be customized to produce time in almost every increment, starting at any time period.

Random Numbers

Simulink has two random number generators which can be used to simulate price or supply fluctuations.

### Other Signals

Data from the workspace or from a specific data file can be used as inputs to a Simulink model. In addition, Simulink includes step functions and chirp signal generators. These can simulate a disturbance, or be used as switches.

### Custom Business Economics Blocks

We have created a small set of blocks that are especially useful in business economics and are used in the models described in this book. They are described below.

### Compound Growth

Simulink does not have a native block for generating a common basis for economic phenomena, namely a series that starts at a base number and grows at a certain rate per year.

To address this need, we created a compound growth block in the Business Economics Toolbox that you can plug into a Simulink model. The block will take a base amount and grow it a certain amount each period. Over a number of periods, this will produce the compound growth that is common in the analysis of business, economics, and other phenomenon.

### Varying Growth

A related question arises when growth is not consistently occurring at the same rate. For this more complex set of calculations, we created a varying growth subsystem.

This block is implemented differently, in that you are asked to identify the initial amount, the time series vector that corresponds to the periods during which this initial amount will change, and then a factor of growth rates with one growth vector for each time period

### Elasticity

A more complicated analytical tool used by economists is the concept of elasticity to describe how a change in one variable affects a change in another. A common consideration in business economics is how changes in prices affect changes in consumer demand. The price elasticity of demand is a convenient way of describing the percentage change in consumer demand caused by percentage change in price.

We created a block in the Business Economics Toolbox that changes the values of one variable on the basis of changes in another variable, using an elasticity factor. Using this block, you can project the path of sales, assuming changes in price and assumed price elasticity of demand. This block might be more precisely defined as "elastic impact" rather than elasticity, as it applies changes to a relationship governed by elasticity rather than calculating it.

 ImpacL Series Elasticity Base Series Our Basa Seríes In Oaslicity Subsystem
0 0