Home  /  Products  /  Stata 18  /  Flexible demand systems

<- See Stata 18's new features

Highlights

  • Cobb–Douglas demand system

  • Linear expenditure demand system

  • Translog demand system

  • Generalized translog demand system

  • Almost ideal demand system (AIDS)

  • Generalized AIDS

  • Quadratic AIDS (QUAIDS)

  • Generalized QUAIDS

  • Expenditure and price elasticities

  • See more features for systems of equations

Eight flexible demands systems in just one convenient command—demandsys! Choose from the Cobb–Douglas demand system, almost ideal demand system (AIDS), generalized AIDS, and more. Estimate the demand for a basket of goods. Compute expenditure and price elasticities to evaluate sensitivity to expenditure and price changes.

Let's see it work

We have data from the Nationwide Food Consumption Survey, and we would like to estimate a demand system for a basket of goods that includes five food categories: dairy products, proteins, fruits and vegetables, flour-based products, and a miscellaneous category with all other food products. The observed data are at the household level. We have variables recording the total expenditure a household spends on food, the share spent on each food category, and the unit price for each food category. The budget shares of all food categories need to sum up to one. This is a typical data structure required for most demand systems. If needed, these variables can be constructed from the quantity purchased and dollar amount paid by the households.

Let's load the dataset and fit the AIDS model:

. webuse food_consumption
(Food consumption)


. demandsys aids w_dairy w_proteins w_fruitveg w_flours w_misc, 
	  prices(p_dairy p_proteins p_fruitveg p_flours p_misc)
	  expenditure(expfd) nolog
Calculating NLS estimates ...
Calculating FGNLS estimates ...
FGNLS iteration 2 ...
FGNLS iteration 3 ...

AIDS model                                        Number of obs        = 4,160
Expenditure variable: expfd                       Number of goods      =     5
                                                  Price index constant = 1.615

Centered R2 for model for:
  Good 1 = 0.0254
  Good 2 = 0.1443
  Good 3 = 0.0731
  Good 4 = 0.1488
  Good 5 = 0.1575

Estimate Std. err. z P>|z| [95% conf. interval]
alpha
Good
1 .1948368 .0057939 33.63 0.000 .1834809 .2061927
2 .2475077 .0090901 27.23 0.000 .2296915 .2653239
3 .3553615 .0072053 49.32 0.000 .3412394 .3694836
4 .1097275 .003782 29.01 0.000 .102315 .11714
beta
Good
1 -.0056867 .0020128 -2.83 0.005 -.0096318 -.0017416
2 .0224212 .0031302 7.16 0.000 .0162861 .0285562
3 -.0234923 .0024448 -9.61 0.000 -.028284 -.0187007
4 -.0009142 .0013059 -0.70 0.484 -.0034738 .0016453
Gamma
Good_g#Good_h
1#1 .0236658 .0027836 8.50 0.000 .0182101 .0291215
1#2 -.0239425 .0030348 -7.89 0.000 -.0298906 -.0179944
1#3 -.0026764 .0026083 -1.03 0.305 -.0077886 .0024358
1#4 -.0001046 .0015118 -0.07 0.945 -.0030677 .0028585
2#2 .1369687 .0057856 23.67 0.000 .1256291 .1483083
2#3 -.0463497 .0039095 -11.86 0.000 -.0540122 -.0386872
2#4 -.0329757 .0022046 -14.96 0.000 -.0372967 -.0286548
3#3 .0602447 .0045134 13.35 0.000 .0513987 .0690908
3#4 -.0008966 .0019898 -0.45 0.652 -.0047965 .0030034
4#4 .0480769 .0017805 27.00 0.000 .0445873 .0515666
Note: alpha estimates are constant terms in expenditure-share equations and also appear in the price index. Note: beta estimates measure sensitivity of expenditure shares to changes in deflated expenditure. Note: Gamma estimates measure the effect of price on expenditure shares across goods.
Normalized parameters
Estimate Std. err. z P>|z| [95% conf. interval]
alpha
Good
5 .0925665 .0044275 20.91 0.000 .0838888 .1012443
beta
Good
5 .0076721 .0015745 4.87 0.000 .0045862 .010758
Gamma
Good_g#Good_h
1#5 .0030578 .0016752 1.83 0.068 -.0002255 .0063412
2#5 -.0337007 .002441 -13.81 0.000 -.0384849 -.0289165
3#5 -.010322 .0021953 -4.70 0.000 -.0146247 -.0060194
4#5 -.0141 .0013383 -10.54 0.000 -.0167229 -.011477
Note: alpha estimates sum to 1. Note: beta estimates sum to 0. Note: Gamma estimates sum to 0 over goods. Shares: w_dairy w_proteins w_fruitveg w_flours w_misc Prices: p_dairy p_proteins p_fruitveg p_flours p_misc Expenditure: expfd

Usually, we do not interpret the above estimated parameters directly; instead, we use them to compute elasticities. We will see some examples of this below.

We might suspect a nonlinear relationship when the Engel curves (relationship between expenditure and income) have a quadratic representation. In the demand system world, we can examine the relationship between the budget share and expenditure:

. generate lnexp = ln(expfd)
. twoway (qfitci w_dairy lnexp), ylabel(,format(%5.2f))   
  ytitle("Budget share") xtitle("Log of expenditure")                         
  title("Nonlinear relationship for dairy products")

Because of the quadratic representation, we might consider the QUAIDS model, which includes the quadratic term of expenditure with respect to the budget shares. Below, we fit a QUAIDS model and we include two demographic variables that also affect demand, the number of children, and the number of adults in the household. These variables are specified in the demographics() option, and they can be included in the model via demographic translation (Pollak and Wales 1978) or demographic scaling (Ray 1983; Poi 2002). We use demographic translation.

. demandsys quaids w_dairy w_proteins w_fruitveg w_flours w_misc, 
            prices(p_dairy p_proteins p_fruitveg p_flours p_misc) 
	    expenditure(expfd) nolog demographics(n_kids n_adults)

(output omitted)

Previously, we created a scatterplot to assess whether there might be a quadratic relationship. To provide statistical evidence of this relationship, we perform a joint test on all the coefficients associated with the quadratic terms:

. test [lambda]1.Good [lambda]2.Good [lambda]3.Good [lambda]4.Good

 ( 1)  [lambda]1bn.Good = 0
 ( 2)  [lambda]2.Good = 0
 ( 3)  [lambda]3.Good = 0
 ( 4)  [lambda]4.Good = 0

           chi2(  4) =   17.21
	 Prob > chi2 =    0.0018

The goal of fitting a demand system is to compute the elasticities, which requires the parameter estimates and data. The postestimation tools for demandsys make elasticities easy to compute.

To compute the uncompensated own-price and cross-price elasticities, we type

. estat elasticities, uncompensated

Uncompensated (Marshallian) price elasticities               Number of obs = 4,160

Price Elasticity Std. err. z P>|z| [95% conf. interval]
Good 1
Good
1 -.7924156 .0195295 -40.58 0.000 -.8306928 -.7541385
2 -.0786559 .007832 -10.04 0.000 -.0940064 -.0633055
3 -.0206943 .0112301 -1.84 0.065 -.0427049 .0013163
4 .019384 .0150455 1.29 0.198 -.0101047 .0488727
5 .0347276 .0187495 1.85 0.064 -.0020207 .0714759
Good 2
Good
1 -.1384879 .0209779 -6.60 0.000 -.1796038 -.097372
2 -.6837299 .0150528 -45.42 0.000 -.7132328 -.6542269
3 -.1917912 .0175009 -10.96 0.000 -.2260924 -.15749
4 -.2638603 .0227633 -11.59 0.000 -.3084756 -.219245
5 -.3757765 .0285612 -13.16 0.000 -.4317554 -.3197976
Good 3
Good
1 -.0185329 .0174749 -1.06 0.289 -.0527831 .0157173
2 -.1450576 .010219 -14.19 0.000 -.1650864 -.1250287
3 -.7147103 .0188897 -37.84 0.000 -.7517334 -.6776873
4 .0104006 .0197939 0.53 0.599 -.0283947 .0491958
5 -.1404446 .0248868 -5.64 0.000 -.1892218 -.0916673
Good 4
Good
1 .0067108 .009852 0.68 0.496 -.0125987 .0260203
2 -.090394 .00554 -16.32 0.000 -.1012521 -.0795358
3 -.0078541 .00832 -0.94 0.345 -.0241611 .0084529
4 -.5173618 .0176534 -29.31 0.000 -.5519619 -.4827617
5 -.1438225 .0147387 -9.76 0.000 -.1727099 -.114935
Good 5
Good
1 .0290916 .0111014 2.62 0.009 .0073333 .0508499
2 -.092548 .0062357 -14.84 0.000 -.1047698 -.0803262
3 -.0483012 .0092789 -5.21 0.000 -.0664876 -.0301149
4 -.1169807 .0134031 -8.73 0.000 -.1432503 -.0907112
5 -.3777875 .0230543 -16.39 0.000 -.4229731 -.3326018

All the own-price elasticities fall above –1, and they range from –.7924 to –.3778. These values indicate that there is an inelastic demand for food products; we also see that some goods are complements for others, and others are substitutes. Above, we requested uncompensated elasticities; if we instead want compensated elasticities, we can specify the compensated option instead of uncompensated; compensated elasticities are smaller in absolute terms because they contain only substitution effects, while uncompensated elasticities also account for income effects.

Suppose we are also interested in the expenditure elasticities for households with two kids. We use the expenditure option to obtain expenditure elasticities and use the if qualifier to restrict the sample to these households:

. estat elasticities if n_kids == 2, expenditure atmeans

Expenditure elasticities                                  Number of obs = 4,160

Expenditure Elasticity Std. err. z P>|z| [95% conf. interval]
Good
1 .9155493 .0232877 39.31 0.000 .8699063 .9611923
2 1.078329 .0149179 72.28 0.000 1.04909 1.107567
3 .9804481 .0201581 48.64 0.000 .9409389 1.019957
4 .8695964 .0212882 40.85 0.000 .8278722 .9113206
5 1.004098 .0246939 40.66 0.000 .9556994 1.052498
Note: Elasticities are calculated at prices', demographic variables', and expenditure means.

All the expenditure elasticities are obtained at sample means, and they are close to 1. Without the transition from expenditure to income, we cannot really say whether they are normal or luxury goods, but the results shed light on how sensitive households are to expenditure changes when it comes to food consumption given the observed data.

References

Pollak, R. A., and T. J. Wales. 1978. Estimation of complete demand systems from household budget data: The linear and quadratic expenditure systems. American Economic Review 68: 348–359.

Ray, R. 1983. Measuring the costs of children: An alternative approach. Journal of Public Economics 22: 89–102.

Poi, B. P., 2002. From the help desk: Demand system estimation. Stata Journal 2: 403–410.

Made for data science.

Get started today.