Chapter Contents |
Previous |
Next |
The MODEL Procedure |
PROC MODEL provides several features to aid in finding errors in the model program. These debugging features are not usually needed; most models can be developed without them.
The example model program that follows will be used in the following sections to illustrate the diagnostic and debugging capabilities. This example is the estimation of a segmented model.
*---------Fitting a Segmented Model using MODEL----* | | | | y | quadratic plateau | | | y=a+b*x+c*x*x y=p | | | ..................... | | | . : | | | . : | | | . : | | | . : | | | . : | | +-----------------------------------------X | | x0 | | | | continuity restriction: p=a+b*x0+c*x0**2 | | smoothness restriction: 0=b+2*c*x0 so x0=-b/(2*c)| *--------------------------------------------------*; title 'QUADRATIC MODEL WITH PLATEAU'; data a; input y x @@; datalines; .46 1 .47 2 .57 3 .61 4 .62 5 .68 6 .69 7 .78 8 .70 9 .74 10 .77 11 .78 12 .74 13 .80 13 .80 15 .78 16 ; proc model data=a; parms a 0.45 b 0.5 c -0.0025; x0 = -.5*b / c; /* join point */ if x < x0 then /* Quadratic part of model */ y = a + b*x + c*x*x; else /* Plateau part of model */ y = a + b*x0 + c*x0*x0; fit y; run;
The program listing from the example program is shown in Figure 14.73.
The LIST option also shows the model translations that PROC MODEL performs. LIST output is useful for understanding the code generated by the %AR and the %MA macros.
The cross-reference from the example program is shown in Figure 14.74.
|
LISTCODE prints the operator and operands of each operation generated by the compiler for each model program statement. Many of the operands are temporary variables generated by the compiler and given names such as #temp1. When derivatives are taken, the code listing includes the operations generated for the derivatives calculations. The derivatives tables are also listed.
A LISTCODE option prints the transformed equations from the example shown in Figure 14.75 and Figure 14.76.
|
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.