The MODEL Procedure

Example 24.6 General Form Equations

(View the complete code for this example.)

Data for this example are generated. General form equations are estimated and forecast by using PROC MODEL. The system is a basic supply and demand model.

The following statements specify the form of the model:

title1 "General Form Equations for Supply-Demand Model";

proc model outmodel=model;
   var price quantity income unitcost;
   parms d0-d2 s0-s2;
   eq.demand=d0+d1*price+d2*income-quantity;
   eq.supply=s0+s1*price+s2*unitcost-quantity;
run;

Three data sets are used in this example. The first data set, HISTORY, is used to estimate the parameters of the model. The ASSUME data set is used to produce a forecast of price and quantity. Notice that the ASSUME data set does not need to contain the variables PRICE and QUANTITY. The HISTORY data set is shown as follows:

data history;
   input year income unitcost price quantity;
datalines;
1976    2221.87    3.31220     0.17903    266.714
1977    2254.77    3.61647     0.06757    276.049
1978    2285.16    2.21601     0.82916    285.858

   ... more lines ...   

The ASSUME data set is shown as follows:

data assume;
   input year income unitcost;
datalines;
1986    2571.87    2.31220
1987    2609.12    2.45633
1988    2639.77    2.51647
1989    2667.77    1.65617
1990    2705.16    1.01601
;

The third data set, GOAL, used in a forecast of PRICE and UNITCOST as a function of INCOME and QUANTITY is as follows:

data goal;
   input year income quantity;
datalines;
1986    2571.87     371.4
1987    2721.08     416.5
1988    3327.05     597.3
1989    3885.85     764.1
1990    3650.98     694.3
;

The following statements fit the model to the HISTORY data set and solve the fitted model for the ASSUME data set:

proc model model=model outmodel=model;

/* estimate the model parameters */
   fit supply demand / data=history outest=est n2sls;
   instruments income unitcost year;
run;

/* produce forecasts for income and unitcost assumptions */
   solve price quantity / data=assume out=pq;
run;

title2 "Parameter Estimates for the System";
proc print data=est;
run;

title2 "Price Quantity Solution";
proc print data=pq;
run;

The model summary of the supply and demand model is shown in Output 24.6.1.

Output 24.6.1: Model Summary

General Form Equations for Supply-Demand Model

The MODEL Procedure

Model Summary
Model Variables4
Parameters6
Equations2
Number of Statements3

Model Variablesprice quantity income unitcost
Parametersd0 d1 d2 s0 s1 s2
Equationsdemand supply

The 2 Equations to Estimate
supply =F(s0(1), s1(price), s2(unitcost))
demand =F(d0(1), d1(price), d2(income))
Instruments1 income unitcost year


The estimation results are shown in Output 24.6.2 and the OUTEST= data set is show in Output 24.6.3. The output data set produced by the SOLVE statement is shown in Output 24.6.4.

Output 24.6.2: Output from the FIT Statement

General Form Equations for Supply-Demand Model

The MODEL Procedure

Nonlinear 2SLS Summary of Residual Errors 
EquationDF ModelDF ErrorSSEMSERoot MSER-SquareAdj R-Sq
supply373.32400.47490.6891  
demand371.08290.15470.3933  

Nonlinear 2SLS Parameter Estimates
ParameterEstimateApprox Std Errt ValueApprox
Pr > |t|
d0-395.8874.1841-94.62<.0001
d10.7173280.56731.260.2466
d20.2980610.00187159.65<.0001
s0-107.624.1780-25.76<.0001
s1201.57111.5977126.16<.0001
s2102.21161.121791.12<.0001


Output 24.6.3: Listing of OUTEST= Data Set Created in the FIT Statement

General Form Equations for Supply-Demand Model
Parameter Estimates for the System

Obs_NAME__TYPE__STATUS__NUSED_d0d1d2s0s1s2
1 2SLS0 Converged10-395.8870.717330.29806-107.620201.571102.212


Output 24.6.4: Listing of OUT= Data Set Created in the First SOLVE Statement

General Form Equations for Supply-Demand Model
Price Quantity Solution

Obs_TYPE__MODE__ERRORS_pricequantityincomeunitcostyear
1PREDICTSIMULATE01.20473371.5522571.872.312201986
2PREDICTSIMULATE01.18666382.6422609.122.456331987
3PREDICTSIMULATE01.20154391.7882639.772.516471988
4PREDICTSIMULATE01.68089400.4782667.771.656171989
5PREDICTSIMULATE02.06214411.8962705.161.016011990


The following statements produce the goal-seeking solutions for PRICE and UNITCOST by using the GOAL data set:

title2 "Price Unitcost Solution";

/* produce goal-seeking solutions for
     income and quantity assumptions*/
proc model model=model;
   solve price unitcost / data=goal out=pc;
run;

proc print data=pc;
run;

The output data set produced by the final SOLVE statement is shown in Output 24.6.5.

Output 24.6.5: Listing of OUT= Data Set Created in the Second SOLVE Statement

General Form Equations for Supply-Demand Model
Price Unitcost Solution

Obs_TYPE__MODE__ERRORS_pricequantityincomeunitcostyear
1PREDICTSIMULATE00.99284371.42571.872.728571986
2PREDICTSIMULATE01.86594416.52721.081.447981987
3PREDICTSIMULATE02.12230597.33327.052.711301988
4PREDICTSIMULATE02.46166764.13885.853.673951989
5PREDICTSIMULATE02.74831694.33650.982.425761990


Last updated: December 20, 2021