Basic Regression

Now let us suppose that you would like to run a regression of real Gross private fixed investment on past changes in real GDP and an estimate of the investment required to replacement capital that is wearing out. If the cursor is not already in the command box, click there. We first set the limits for the regression, the starting and ending dates. To estimate the regression with data from 1998 first quarter to 2011 fourth quarter, type:

lim 1998.1 2011.4

and tap ‘Enter’. (If your data bank has data more recent than the fourth quarter of 2011, then by all means use it.) You should see your command echoed in the results area. Then give a title to the regression with the title command:

ti Gross Private Domestic Fixed Investment

Next, you must form ‘d’, the first difference of real GDP, by using the f command:

f d = gdpR - gdpR[1]

The remaining variable we need is requirements for replacement, which you may calculate by:

f replace = 0.05*@cum(stockf, vfR[4], 0.05)

It is not necessary for the regression, but you may be interested to see how this replacement compares to investment spending. To draw a graph with the two, use the graph command:

gr replace vfR

Now you are ready for the regression itself. Just issue the r command by typing

r vfR = replace,d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11]

There now should appear in the results area the numeric display similar to that shown for Model 5 in Chapter 1 of The Craft of Economic Modeling. The font in the results area is set small so that you see most of the regression output. Many people, however, find that it is uncomfortably small. If you stretch the window to the right with the mouse, the font size will automatically increase. If you want the larger font without stretching the window, click File | Auto Font Size, so as to remove the check mark by this item. Then click File | Font and set the size. Also, a good choice of font is “FixedSys”, which has a fixed size. You may also set the font color and “script” or character set. If you are using in titles and comments a language such as Greek, Russian, Turkish, or Polish with characters that do not appear in the Western European languages, be sure to select the proper character set for the results window. It automatically will be carried over to the editor, the “look” command, and other displays. By clicking File | Background color, you can select the background color of the results window. Your choice of font (typeface, size, color, and character set) and your choice of background color will be remembered when you next start G7. (This generally pleasant feature can be a confusing if you are using G7 on a public machine in a computer lab; depending on the operating system, you might start off with the settings of the previous user.)

To obtain the graph of the regression just done, give the command

gr *

To see the graph better, it may be maximized by clicking the maximize button, the middle button in the upper right corner of the graph. Click again the button in the same place to get the graph back to its original size. If you would like to save the graph for comparison with later graphs, select Graph | Shift1 Graph | Shift1 from the main menu. The graph shifts to a smaller window in the upper right of the screen. You can also use Graph | Shift2 Graph | Shift2. Thus, you can view three different graphs at once.

You now have seen four examples of G7 commands – title, f, r, and gr. Although most of what you need to do can be done with a dozen or so commands, there are more than one hundred in all. Should you wish to see a list of them, see the G7 Reference Manual Reference Manual .