Building a ModelΒΆ

The “Model” item on the G7 main menu will guide you through the steps of building and using a model. The Craft of Economic Modeling, Volumes 1-3, by Clopper Almon are available online in PDF form and provide additional guidance. References to this book are made in the text below.

The first step is to create a Master file that specifies the regression result files – the .SAV files – which will be used in the model together with other identities necessary for the model. Selecting Model | Master will show the current contents of the master file in the editor. Each regression equation is brought into the model with a command of the form “add XXX.SAV”, where xxx is the usually the name of the dependent variable in the regression. This must be the same name that appeared on the save line in the .REG file by which the equation was estimated. When you are adding an equation to the model, the first thing you should do is to modify the master file to include the new equation. Generally, it is not crucially important where the add command appears, but it is natural to place it after the determination of the explanatory (right-hand-side) variables that it uses.

Besides the add commands to include regression equations, the Master file may also have identities such as f or id commands and definitions of exogenous variables with fex commands.

At the bottom of the master file there should be one or more check commands, for example:

check cR 0.2

The check commands control the iterative solution of simultaneous models as explained relative to Model 5 in Chapter 1.

Note carefully that you conclude the editing of a Master file by clicking Save on the editor menu – not Run. You want to use the Master file as input into the Build program, not the G7 program. Clicking Run will accomplish nothing useful and may consume a good bit of time as you respond to various “bad command” messages.

The second step is to estimate all of the equations and save the results in .SAV files. This step is not mentioned under the Model menu items because it involves all of the other capabilities of G7. We already have seen several examples and the following chapters have many more.

The third step is to build the model. This step is accomplished by selecting Model | Build. This command opens a command prompt window and executes the MODEL.BAT file that should be in the folder containing your master file. This batch file contains the following lines:

build master
make -fc:\pdg\run.bpr
pause

For the first line of MODEL.BAT to work correctly two things are necessary:

  • The Build program, BUILD.EXE, must be in the C:\pdg directory and this directory must be on the system’s path. This directory should also contain the files RPROTO.H, COMMON.INC, and GCOMMON.INC. All of these files will have been placed in C:\pdg in the process of installing G7. To put this directory onto the system path system path, see the Installation page of the G7 Help Files or see the README documents that accompany the software installation files.

  • A BUILD.CFG file must be in the directory (or folder) in which you are building the model. Here is the BUILD.CFG file for the Quest model. It is very similar to the G.CFG file and even has two irrelevant lines to maintain that similarity. You can copy this file from the AMI demonstration program and modify it to fit your needs, or you can use this example.

    Name of workspace; bws.bnk
    Name of workspace index; bws.ind
    Name of default bank; quip.bnk
    Name of default bank index; quip.ind
    Path to files (like RPROTO.H) for inclusion; c:\pdg
    Reserved for future use; x
    Default regression limits (not actually used); 1980.1 1998.3 1998.3
    Default base year of workspace file; 1960
    First month covered; 1
    Default maximun number of observations per series in workspace; 240
    Do you wish to supply convergence test and subdivision manually?; n
    Is there a global declaration file "global.inc" to be included?; y
    

For the second line of MODEL.BAT to work correctly, the Borland C++ compiler must have been installed and be on the system’s path. Installation normally puts it on the path.

The Build program, run by this step, reads the master file and all the .SAV files, writes a C program, HEARTA.C, to execute the model, and compiles and links this program to produce an executable file, RUN.EXE, which is the model in the form of a program ready to run. This step also creates

bwsw:is a data bank containing all the variables used in the model
RUN.GR:a command file for G7 to graph all the variables in the model
RUN.ERR:a record of all the diagnostic information provided by the Build program. Be sure to check it by looking at it with the editor. If you have included the command addtype y in your Master file, then this file also will contain everything in the Master file and in the files which are “added.” If you include at the top of the Master file the command checkdup y, then Build will check every f or *fex command to see if it is calculating a variable that had been calculated earlier and, if so, whether the values are identical. This check is a powerful means of identifying common errors in model building. Check your RUN.ERR file frequently.
EXOGALL.REG:a command file for G7 to create mechanical projections of all exogenous variables in the model by regressing them on time. Look at EXOGALL.REG to see what it does. The projections will be put into files with the variable name as the name of the file and .XOG as the extension.
RUN.XOG:a file to use all the .XOG files made by running EXOGALL.REG.
SKIPALL.FIX:a file to “skip” the calculation of all the variables calculated by regression equations. When all the regression equations are skipped, these variables become essentially exogenous and the model becomes tautological. Hence, its historical simulation should completely reproduce history. If it fails to do so, then there is something wrong with the identities. Since it is very easy to make mistakes in the identities, it always is important to run a model with all regressions skipped. This file makes it easy to do so.
RUN.NAM:a file with the names of all variables in the model and their numbers necessary to read the hearta.c program should you have to do so. With luck, you won’t need to ever look at heart.c or run.nam.
HEART.DAT:
HEART.DIM:
RUN.LAG:
RUN.MAP:these files are internal to the system. You should not need to look at them.

With the model built, you are ready to run it. See the next topic for details.

Previous topic

Modeling with G7

Next topic

Running a Model - Deterministic Simulation

This Page