Thursday, November 27, 2014

Thankful for "G7"

This series of posts began on 18 November

Happy Thanksgiving.

First chance I've had to take a look at G7 since installing it.

When you first run G7 a configuration window opens. I don't understand the settings, so I just click OK. The configuration window closes and two new windows open. The bigger window is the G7 program. The smaller one is a demo file. There is no activity.

The G7 window tells my "present working directory" and provides the title of the data that's been loaded in. Looks like a setting in the configuration window determines which data gets loaded in.

The smaller window is more interesting. You can read it:

# This demo script provides the user with a solid foundation...

Several lines of text there, with a crosshatch before each line. I guess we should call it a "hash symbol" now. Several lines a "hash" prefix. Then

addp n

CLS means CLear the Screen. I know that one. That's from BASIC. GW-BASIC had the CLS command, back in the days of DOS.

I don't know what the ADDP N is. Next there are several more lines of text

ic If you have any trouble with this demo script...

but this time the lines all start with the letters IC instead of a hash symbol. That tells me these lines are for a different purpose than those other lines of text. (When you run the script, the lines with the IC prefix are displayed as text. The lines with the hash symbol prefix are not displayed. I conclude that the hash symbol means the line is a comment, in the G7 language.)

Then there is the line

pause "When you are done reading, click OK."

followed by another CLS command.

Back in the bigger window, G7, I can type and see what I'm typing, but nothing happens when I press ENTER. I played with this a bit and had a thought. The smaller window is an editor... The smaller window is for user input. The bigger window is for G7's output. So then, if ENTER doesn't work in the big window it's not a problem. That window isn't for my input.

In G7 (the bigger window) across the top there is a toolbar with a few buttons: "G Editor", "Change Directory", "Change Font" ... I clicked on "G Reference". A Windows window popped up instead of the G Reference. The window said Windows Vista can't read older-style Windows Help files. There was a link to a download, an enhancement to Vista that lets me read the older Help files. It was easy to resolve this problem. But file it under Stupid Problems.

Windows can't read Windows Help files????? Give me a break!

So now the "G Reference" button opens the G Reference, and that'll be a handy thing. I went there, and went to "The Basic 11 G7 Commands" first, as they suggest.

This is amazing. Look what they have for the f command:

f <variable> = <expression>
f <variable>{<date1> [- <date2>]} = <expression>
    Defines variable on left in terms of variables in expression on right.

f x = gnp/(1. + unemp[1]*@exp(.25*time))
f index = x/x{85.1}

Note:  []  denotes lags  (t-1) is denoted [1]
        @  introduces a function (see list of functions)
        {date} on the right-hand side denotes a specific observation. 
        {date} on the left-hand side assigns values over the given range of periods.

First impression: Wow!

They give two forms for the "f" command (shown in green). The first one looks like a pretty simple assignment of value:

<variable> = <expression>

Create a variable and assign a value to it. Simple, everyday stuff you could find in any computer language, right? Yeah but hold on a minute. I read about the "f" command in the demo. Here's the relevant part of the demo script file:

ic =====================
ic =====================
ic f <variable> = <expression>
ic A variable on the left-hand side is defined [as] the expression on right-hand
ic side. The new variable is stored in the workspace bank and can have
ic any name. For example, if you wanted to create an index of rtlsales44111
ic using June of 2000 as its base, type
ic "f index44111 = a.rtlsales44111/a.rtlsales{2000.006}" into the
ic command line. This new variable can be printed or graphed.

addp y
f index44111 = a.rtlsales44111/a.rtlsales44111{2000.006}
ty index44111
gr index44111
addp n

pause "When you are done reading, click OK."

The number 44111 identifies some particular data series (sort of like TCMDO identifies a particular data series at FRED). You can make a variable that is an "index" of that series. The line

f index44111 = a.rtlsales44111/a.rtlsales44111{2000.006}

divides each value of the source data series by the June 2000 -- 2000.006 means the sixth month of year 2000 -- divides each value by the June 2000 value of that series. This creates a whole new data series that looks like the source series, but with the June 2000 value shrunk down to 1.0 and all the other values shrunk down in proportion. So the "variable" we create can be a whole new data series.

This is a big deal.

You'll often see me talk in those terms. I might show you a graph of TCMDO divided by GDP that displays 50 years of quarterly data. Four values for each year, so 200 values were used to make the graph. But when I talk about how these values change over the years, I say "the number changed" over the years, as if it was just one number rather than 200 separate numbers. Just one number (for a period of time).

Just one variable in G7, but the variable holds a whole data series. This is good stuff.


Anonymous said... (make sure to get the mouseover text)

The Arthurian said...

If I ever have an economist actually stop and think about what I'm saying, it will be because I say it in the language of economists, the language of economic models.