Figure 1: Quantity and Price for Beef
The price elasticity of demand is defined as the percentage change in quantity demanded for some good with respect to a one percent change in the price of the good. For example, if the price of some good goes up by 1%, and as a result sales fall by 1.5%, the price elasticity of demand for this good is 1.5%/1% = 1.5. Thus, price elasticity measures responsiveness of quantity demanded to changes in price. Price elasticity greater than one is called price elastic, and price elasticity less than one is called price inelastic. A given percentage increase in the price of an elastic good will reduce the quantity demanded for the good by a higher percentage than for an inelastic good. In general, a necessary good is less elastic than a luxury good. For an introductory text on price elasticities, see Nicholson (1992). Price elasticity can be expressed as:
where is the price elasticity, P is the price of the good, and Q is the quantity demanded for the good.
In this example, you will calculate the price elasticity of demand for beef in a simple loglinear demand model. The data consist of quarterly retail prices and per capita consumption for beef. The data period covers the first quarter of 1977 through the third quarter of 1999. The data were obtained from the USDA Red Meats Yearbook (accessed 2001).
The loglinear demand model is of the following form:
where Q and P are defined as before, a and b are parameters to be estimated.
The loglinear demand model is a very simple one. In the real world, there may be many additional complexities that need to be considered in the model. For example, prices of some other closely related goods may have a significant effect on the quantity demanded for beef; hence, they may also enter the righthand side of the demand equation. On a store level, there may also be occasions when sales remain zero regardless of how much the price is; for example, when the good is out of stock. For demonstration purposes these complexities will be ignored.
The loglinear demand function implies that the price elasticity of demand is constant:
Thus, to obtain an estimate of the price elasticity, you just need an estimate of b. You can use the AUTOREG procedure to obtain the estimates.
To use the AUTOREG procedure, you first read in the price and quantity data in the DATA step, and transform the price and quantity data into log forms:
data a ; input yr qtr q p ; date = yyq(yr,qtr) ; format date yyq6. ; lq = log(q) ; lp = log(p) ; datalines; 1977 1 22.9976 142.1667 1977 2 22.6131 143.9333 1977 3 23.4054 146.5 1977 4 22.7401 150.8 1978 1 22.0441 160 ... more datalines ... 1997 4 16.2354 279.3 1998 1 16.6884 273.4667 1998 2 17.1985 278.1 1998 3 17.5085 277.3667 1998 4 16.6475 279.5333 1999 1 16.6785 278 1999 2 17.7635 284.7667 1999 3 17.6689 289.2333 ; run ;
Then you specify the input data set in the PROC AUTOREG statement and specify the regression model in a MODEL statement. If you are not concerned with autocorrelated errors and just want to do an ordinary leastsquares regression, you can specify the model as follows:
proc autoreg data=a outest=estb ; model lq = lp ; output out=out1 r=resid1 ; title "OLS Estimates"; run ;
This will yield ordinary least squares estimates of a and b. The output is shown in Figure 2.
Figure 2: OLS EsimatesThe parameter estimate for b is equal to 0.5314, which suggests that increasing the price for beef by 1% will reduce the demand for beef by 0.53%.
The following SAS code uses the GPLOT procedure to plot the residuals obtained from the OLS estimation, as shown in Figure 3.
proc gplot data=plot2 ; title 'OLS Model Residual Plot' ; axis1 label=(angle=90 'Residuals') ; axis2 label=('Date') ; symbol1 c=blue i=needle v=none ; plot resid1*date / cframe=ligr haxis=axis2 vaxis=axis1 ; run ;
Figure 3: OLS Model Residual Plot
Note that the residual errors from the OLS regression do not appear to be random. The residual plot shows evidence of autocorrelation in the error process. This violates the independent error assumption of the classical regression model, and the OLS estimates will be inefficient. Thus, the parameter estimates are not as accurate as they could be.
To improve the efficiency of the estimated parameters, you can correct for autocorrelation using the AUTOREG procedure. Specify the order of autocorrelation using the NLAG= option. Since the data are quarterly, this example chooses order 1 as well as order 4 for seasonality considerations. You can use the METHOD= option to specify the maximum likelihood estimation.
proc autoreg data=a outest=estb ; model lq = lp / nlag=(1 4) method=ml ; output out=out2 r=resid2 ; title "OLS, Autocorrelations, & Maximum Likelihood Estimates"; run ;
The output in Figure 4 first shows the initial OLS results. Then the estimates of autocorrelations and the maximum likelihood estimates are displayed.
The AUTOREG Procedure
The AUTOREG Procedure

By including an autoregressive error structure in the model, the total R^{2} statistic increases from 0.8521 to 0.9422 in the maximum likelihood estimation. The information criteria AIC and SBC become more negative. These imply significant improvement over the OLS estimation.
Notice also that the estimate for b changes from 0.5314 to 0.4131, which means that the estimated elasticity for beef demand is smaller in absolute value than the OLS estimate. Since the estimated elasticity is smaller than 1 in absolute value, you may conclude that demand for beef is relatively inelastic.
Figure 5 illustrates the residuals obtained from the autoregressive error model estimation.
proc gplot data=plot2 ; title 'Autoregressive Error Model Residual Plot' ; axis1 label=(angle=90 'Residuals') ; axis2 label=('Date') ; symbol1 c=blue i=needle v=none ; plot resid2*date / cframe=ligr haxis=axis2 vaxis=axis1 ; run ;
Figure 5: Autoregressive Error Model Residual Plot
Nicholson, W. (1992), Microeconomic Theory: Basic Principles and Extensions, Fifth Edition, Fort Worth: Dryden Press.
SAS Institute Inc. (1999), SAS/ETS User's Guide, Version 8, Cary, NC: SAS Institute Inc.
USDAERS Electronic Data Archive, Red Meats Yearbook, housed at Cornell University's Mann Library, [http://usda.mannlib.cornell.edu/], accessed 25 September 2001.