.. index:: single: Building Models single: G7 Command; sty single: G7 Command; cc single: G7 Command; f single: G7 Command; fex single: G7 Command; fdup Model Building ============== This help topic discusses some of the *G7* commands that are useful for model building. See `The Craft of Economic Modeling `_ by Clopper Almon for more on the use of *G7* and *Build* to build macroeconomic models. **save ** Opens the named file which then receives all *(ti)tle*, *f*, *fex*, *id*, and *cc* commands exactly as they appear on the screen. It also catches the output of *(ty)pe* commands but with the *(ty)pe* changed to update. Most important, the file receives the results of regressions in the form of equations with the variable names and values of the regression coefficients. Use *save off* to close the saved file and stop saving. By convention, not necessity, all "save" files are given the extension ".SAV". *f*, *fex*, and *fdup* all do the same thing in *G7*, but when passed to *Build* through a *G7* "save" file: :f: Computes the left-side variable and puts it and all of the right-side variables into the workspace, and also puts an identity into the model. :fex: Computes the left-left side variable and puts it into the workspace. It does NOT put the right-side variables into the workspace and does NOT put an identity into the model. It is used to define historical values of exogenous variables, such as tax rates, and historical values of dependent variables of behavioral equations. :fdup: This has no effect whatsoever in *Build*. **id ** This has no effect in *G7* but, when passed to *Build*, puts all variables (without computing the left-side one) into the workspace and puts an identity into the model. **check ** This command can only be placed in a "master" file for input into *Build*. It causes the named variable to be checked for convergence to within the specified tolerance. The values of the checked variables will be printed on the screen as the model runs. It generally is necessary to check only a few of the variables in a model. **cc ** This has no effect in *G7* or *Build*, but the C-language statement is passed through to the file HEART.C, which contains the model written in the C language and is ready for compilation. Such passed-through statements may be used to do special tasks for which *G7* and *Build* have no convenient mechanism -- such as scaling one group of variables to sum to another variable. For many models, no *cc* statements are needed. **sty ** Silent type. Prints the variable to the file being saved, but does not show it on the screen. See also the *type* command. **Matrix Operations in Models** For models involving matrices that vary over time, the *InterDyme* system should be used. However, constant matrices can be built into a model as described here. The following matrix commands can be placed only in a master file for input into *Build*. When they are used, the value of *dimmax* in COMMON.INC must be set equal to the largest dimension of the largest matrix. | **vec = , , , , ..., ** | **vec = , ** | Defines the vector with rows and columns. The two-dimensional specification is used to distinguish between row vectors and column vectors. The *vec* command forms the vector by putting the variables , , ..., into the corresponding components of . When the variables , ,..., are not specified, the *vec* command defines a zero vector. In the following example, fd is a column vector and nulv is a row vector. :: Example:: vec fd = 2,1,auto,food vec nulv = 1,4 | **mat = , , ** | **mat = , ** | Defines the matrix with rows and columns. The entries of are fetched from the given file row by row. When the file name is not specified, the *mat* command defines a zero matrix. Example:: mat iomat = 78, 78, io77.usa mat cmat = 78, 34 | **mop = + ** (matrix addition) | **mop = - ** (matrix subtraction) | **mop = * ** (matrix multiplication) | **mop = '** (transposition) | **mop = ^ ** (vector component-wise multiplication ) | Performs matrix operations. When addition, subtraction, multiplication, or transpose is done, the resulting matrix is stored in matrix . With the ^ operation, the i-th component of the vector will be the product of the i-th components of vectors and . WARNING! All matrices and vectors should be defined by the *mat* command and *vec* command before using the *mop* command.