Testing the Laws of Demand

Explain four considerations taken into account by top managers when formulating policies.
April 1, 2017
DQ response
April 1, 2017
Show all

Testing the Laws of Demand

Assignment 2


In this exercise, we fit demand equations for consumer goods using annual US time series data, and test some of the hypotheses generated by the economic theory of the consumer.


The equations we fit have the log-linear form:

log xt = β0 + βp log pt + βq log qt + βy log yt + ut,                                                                                        (1)


  xt pt qt yt ut =





real expenditure on the good price index of the good

price index of the other goods consumers’ real income disturbance term.

The Data      


Copy the file QM Ex3.tsm from the web page. The data for this exercise are made available by Dr. Christopher Dougherty of LSE, and accompany his book Introduction to Econometrics (OUP). The data file is called newdemand.xls. This file contains annual observations for the period 1959-2003 on US real aggregate expenditures and prices for a selected range of commodity groups. Table 1 below lists the variable names.


The actual (billions of) dollars expended in each commodity category can be found as the product of the real expenditure and price variables. The latter are often called the “implicit deflators”. In practice, the deflating is generally done at a more disaggregated level.


Taking food, for example, prices will be measured for all the many different sub-categories (variates of bread, meat, vegetables, and etc.) and used to create series of real expenditure for each. Adding these together produces the FOOD series, and the PFOOD is calculated as the ratio of actual to real expenditure, times 100 to express as a percentage. This is why all the prices equal 100 in the year 2000.


Adding together all real expenditures produces the variable TPE, and PTPE is the personal ex- penditure deflator. DPI is TPE plus real savings – in other words, money savings deflated by PTPE.


We usually treat the saving/consumption decisions as separate and prior to the decision about what to spend on what goods. This approach points to using total expenditure as the ‘income’ variable in demand equations. However, DPI is often used in practice, and we should know how crucial the choice is. Check how sensitive your results are to changing the income measure.


Commodity Real Expenditure


($ billions, at 2000 constant prices)

Price Index





Food purchased for off-premises consumption Clothing and shoes

Gasoline and oil Tobacco products

Flowers, seeds and potted plants Nondurable toys and sport supplies

Magazines, newspapers, and sheet music





Telephone and telegraph TELE PTELE
Local Transportation; mass transit systems MASS PMASS
Physicians DOC PDOC
Legal services LEGL PLEGGL
Religious and welfare activities RELG PRELG
Admissions to spectator amusements ADM PADM
Personal business BUSI PBUSI
Books and maps BOOK PBOOK
Furniture FURN PFURN
Ophthalmic products OPHT POPHT


Table 1:


The following series are also in the data set.


Total personal expenditure                         TPE    PTPE Disposable personal income                   DPI

US Population (thousand)   POP


Data Preparation


After selecting a commodity for analysis, the data first have to be organised and transformed.


In the following steps we refer to a non-existent commodity category called CAT. In practice, replace CAT everywhere in what follows by the code of your chosen category.

1.Double-click the TSM file QM Ex3.tsm to start the program and load the main data set. 2.Create a new data file containing just the variables needed for the analysis, as follows. In the

Setup / Data Transformation and Editing dialog, highlight CAT, PCAT, TPE, PTPE, DPI, and POP in the variable list. Then give the command Edit / Save Selected. When the file dialog opens, type cat.xls and press OK.

  1. Open the file you have created with command. File / Data / Open · ·.
  2. Construct a series for the “price index of other goods”. In general, let x denote real expenditure on a good with price p, and also let X denote real expenditure on all goods, and denote the general price level by P . Then q, the implicit price of goods other than x, is defined by the equation P X = px + q(X x), which rearranges as

q = P X px .

X x

In particular, suppose x is the expenditure on commodity category CAT, p is the price index PCAT, X is TPE and P is PTPE. In the Setup / Data Transformation and Editing dialog, click the “Formula · · ·” button and type the following into the text field:



(note: Variable names are case sensitive. Be sure to use capitals here!). Click <<  Go >>. The QCAT variable should appear in the variable list. If not, check your formula carefully!.

  1. Calculate the price of food relative to other In the Formula dialog click New, then enter PREL = PCAT/QCAT in the text field and press << Go>> as before.


  1. Express the expenditure and income variables in ‘per capita’ In the same way as before, create the variables CATPC = CAT/POP, TPEPC = TPE/POP and


Note that your formulae are saved, and can be edited and re-used as required, use Next and

Previous to navigate the list. Press Close to close the Formula window.


  1. Take logarithms of the variables you will use in the equation. In the Setup / Data Trans- formation and Editing dialog, highlights CAT, PCAT, QCAT, PREL, TPE, DPI, POP, CATPC, TPEPC and DPIPC. Then click Transform, choose Logarithm and click Go.
  2. Save your data by pressing the Save Modified Data


Exercise (do these for two contrasting commodities).


Basic Demand Model


  1. Use OLS to estimate the demand equation (1), and determine 95% confidence intervals for    the income and own-price
  2. Test the law of demand: the null hypothesis βp = 0, against the alternative βp <
  3. Test the homogeneity restriction βp+βq = This can be done several different ways, including these:
    • Replace Log PCAT in the equation by Log PREL. In this equation, use the t test to test the significance of Log QCAT.
    • Use TSM’s Wald Test Open the Model / Parameter Constraints dialog, choose Coded Restrictions, and click on enter Code. Type the parameter restriction in the form


a[i] = -a[j],

where i and j are the parameter numbers for βp and βq – see the Values / Equation dialog to get these numbers. Make sure that the option “Wald Test of Constraints” is selected in model / Linear Equation before re-running the regression. Be careful to explain in your answer why these two methods should always yield the same result.

  1. Compute the model forecast of demand in 2003, using the actual price and income data for that year – in other words, fit the model to 1959-2002, and tell TSM to use the final period for forecasting. This is called an ex post forecasting exercise. Report the actual forecast error, and use the Chow forecasting test to test that it is drawn from the same distribution as the sample period residuals (i.e. normal with the same mean and variance).

Additional Variables.

  • Add Log POP to the equation. Is the effect of population significant? If the coefficient of Log POP is equal to 1 βy, this implies that the expenditure and income data should be expressed in per capita form. (Why?) Test this


6.(Optional) A parital adjustment model: add the lagged dependent variable to the equation. (The easiest way to do this is to add Log CAT as a Type 2 variable, and set the “Lags” scrollbar to 1. Note that the current value is excluded automatically.)

−                 −                        −

Consider how to interpret this equation. If the coefficient of Log CAT(-1) is γ, compare your estimates of βp/(1 γ), βq/(1 γ) and βy/(1 γ) with the elasticities obtained previously. Explain this connection. How can you test the restrictions of demand theory in this setup?


Model Stability Analysis


A time series analysis assume that the model is constant over time,  but there are a number of reasons why this may not be true.

  • The model could shift with the passage of time due to changes in consumers’ tastes,  or changes in the quality and diversity of the goods, or other extraneous factors. The demand for tobacco may be influenced by medical warnings on health risks (early 1970s onwards). The demand for gasoline may be affected by the imposition of a national 55 mph speed limit in the US (1974 – 1995). And so
  • Our theoretical model describes the behaviour of the individual consumer, but we are fitting it to aggregate data on the US If we assume, (a) that the price elasticities are the same for everyone, and (b) that the income distribution is  constant  over  the sample period, the log-linear model can be aggregated over agents. In other words, the estimated elasticities can be related to those of the typical family. But if the income distribution changes, then βp is not constant over time, even if tastes are constant.

There are two ways (both rather crude) to test for the existence of such effects.

7.Do the Chow parameter stability test, after splitting the sample into two roughly equal parts. 8.Let the intercept of the model changes systematically with time. This effect is created by

· · ·

including the trend dummy variable in the model, the variable t = 1, 2, , n. To add a time trend, click the “Trend” check box in the Linear Regression dialog. Test its significance in your equations, and if it is significant, check whether the outcome if any of your previous test depends upon it.

You may find that when the trend term is included the model collapses, with nonsensical estimates for the other parameters. For example, your income elasticity could become negative. If so, this is likely to be due to the problem of multicollinearity. There may not be enough independent variation in the variables to measure the elasticities effectively,  once the linear trend is taken into account. It is useful to know that this kind of thing is occurring, because it shows the data are not ‘rich’ enough (i.e., do not vary enough) to allow changes in tastes to be distinguished from the price and/or income effects.