Chapter Contents |
Previous |
Next |
The MODEL Procedure |
If you are estimating large systems, you need to be aware of how PROC MODEL uses computer resources such as memory and the CPU so they can be used most efficiently.
For example, you could use
proc model; /* Model goes here */ fit / data=a(obs=25); fit / data=a;
where OBS=25 selects the first 25 observations in A. The second FIT statement produces the final estimates using the full data set and starting values from the first run.
You can use the FIT statement to select for estimation only the parameters for selected equations. Do not break the estimation into too many small steps; the total computer time required is minimized by compromising between the number of FIT statements that are executed and the size of the crossproducts matrices that must be processed.
When the parameters are estimated for selected equations, the entire model program must be executed even though only a part of the model program may be needed to compute the residuals for the equations selected for estimation. If the model itself can be broken into sections for estimation (and later combined for simulation and forecasting), then more resources can be saved.
For example, to estimate the following four equation model in two steps, you could use
proc model data=a outmodel=part1; parms a0-a2 b0-b2 c0-c3 d0-d3; y1 = a0 + a1*y2 + a2*x1; y2 = b0 + b1*y1 + b2*x2; y3 = c0 + c1*y1 + c2*y4 + c3*x3; y4 = d0 + d1*y1 + d2*y3 + d3*x4; fit y1 y2; fit y3 y4; fit y1 y2 y3 y4; run;
You should try estimating the model in pieces to save time only if there are more than 14 parameters; the preceding example takes more time, not less, and the difference in memory required is trivial.
The number of bytes needed for two crossproducts matrices, four S matrices, and three parameter covariance matrices is
Consider the following model program:
proc model data=test2 details; exogenous x1 x2; parms b1 100 a1 a2 b2 2.5 c2 55; y1 = a1 * y2 + b1 * x1 * x1; y2 = a2 * y1 + b2 * x2 * x2 + c2 / x2; fit y1 y2 / n3sls; inst b1 b2 c2 x1 ; run;The DETAILS option prints the storage requirements information shown in Figure 14.29.
The matrix X'X augmented by the residual vector is called the XPX matrix in the output, and it has the size m+1. The order of the S matrix, 2 for this example, is the value of g. The CROSS matrix is made up of the k unique instruments, a constant column representing the intercept terms, followed by the m unique Jacobian variables plus a constant column representing the parameters with constant derivatives, followed by the g residuals.
The size of two CROSS matrices in bytes is
Figure 14.30 shows an example of the output produced by the MEMORYUSE option.
|
Definitions of the memory components follows:
symbols | memory used to store information about variables in the model |
strings | memory used to store the variable names and labels |
lists | space used to hold lists of variables |
arrays | memory used by ARRAY statements |
statements | memory used for the list of programming statements in the model |
opcodes | memory used to store the code compiled to evaluate the |
expression in the model program | |
parsing | memory used in parsing the SAS statements |
executable | the compiled model program size (not correct yet) |
block option | memory used by the BLOCK option |
cross ref. | memory used by the XREF option |
flow analysis | memory used to compute the interdependencies of the variables |
derivatives | memory used to compute and store the analytical derivatives |
data vector | memory used for the program data vector |
cross matrix | memory used for one or more copies of the Cross matrix |
X'X matrix | memory used for one or more copies of the X'X matrix |
S matrix | memory used for the covariance matrix |
GMM memory | additional memory used for the GMM and ITGMM methods |
Jacobian | memory used for the Jacobian matrix for SOLVE and FIML |
work vectors | memory used for miscellaneous work vectors |
overhead | other miscellaneous memory |
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.