Introduction to GAUSS on SSDS Unix machines

C. Cameron, Dept. of Economics, Univ. of Calif. - Davis

This handout

What is GAUSS?

GAUSS is a very flexible programming language that is widely used for econometrics applications more complicated than those handled by basic packages such as Shazam, Limdep and Stata.

Advantages of Gauss include:
(1) It is a matrix programming language. [For example, given appropriately defined matrices x and y, the OLS estimator can be calculated as bols = invpd(x'x)*x'y;]
(2) The Gauss program MAXLIK (a Gauss add-on) works well for nonlinear optimization problems such as m-estimators. [For example, GMM and maximum likelihood].
(3) It has excellent looping facilities for storing results. So it is good for simulation.
(4) It has excellent graphics.

Many of these features are also shared by other matrix programming languages, notably MATLAB, S-Plus and SAS/IML. We use Gauss because this is the standard in cross-section nonlinear econometrics.

Disadvantages of Gauss include:
(1) It is not as simple as standard packages. In particular, for reading in and transforming data and initial OLS analysis etc. it is better to use a package such as Limdep.
(2) The manual is not easy to read.

Documentation for GAUSS

There are two volumes to the Gauss manual (revision date September 23 1996)
Volume I: System and Graphics Manual
Volume II: Command Reference Manual

The first volume is the most useful. In particular for initial use read (and do on the computer)
Chapter 1: Language Fundamentals
Chapter 2: Operators (especially matrix operators).
Also useful is the Tutorial which is Chapter 3 in earlier versions of the manual but is no longer included in the manual.

The second volume gives detail on specific Gauss commands. This information can also be found while running Gauss using the Gauss help facility.

The Gauss add-ons have their own manuals. In particular, you may be interested in
Gauss Applications: Maximum Likelihood
Despite its name this is more general than maximum likelihood and also does e.g. GMM.

The Gauss homepage is http://www.aptech.com/
A useful link is to Links & Other Resources.
In particular you can link to http://eclab.econ.pdx.edu/gpe/ toc.htm GAUSS Programming for Econometricians - a web-based course.
Also the site http://weber.u.washington.edu/~ezivot/gaussfaq.htm includes information from the help files in the DOS version 3.2.13. Command Summary Mathematical Operators Publication Quality Graphics Proc MAXLIK These are well worth printing out.

And don't forget that Gauss has its own on-line help, using the Gauss command help.

Versions of GAUSS

There are Windows, DOS and Unix versions of Gauss. These are relatively interchangeable.
Gauss is quite expensive. So we use a Unix rather than PC version.

Here I focus on the Unix version on the SSDS computer BLACK. I assume that you connect to Black from a PC by running a telnet session.

There are two ways to run Gauss on the Unix machine: with a text interface and with a graphics interface.
With a graphics interface is better, but this requires that your computer has X-windows emulation software such as Exceed. The command to run Gauss is simply gauss
I will assume that you do not have this software, and we instead use the text inteface. The main loss is that the Gauss editor cannot be used. The command to run Gauss will be gauss -v

Running Gauss on ARE Unix Machines (Deloach)

For ARE students. For details see
http://www.agecon.ucdavis.edu/Computer/software/gauss.html
or ARE computer staff.

Running Gauss on SSDS Unix Machines (Miller)

For Econ students. You need an account on Miller. If you do not have one, obtain one from the SSDS staff.

(1) Telnet to miller.ucdavis.edu
(2) Log on
(3) At the unix prompt give the command gauss -v
(If you have X-windows emulation you can instead give the shorter command gauss).
(4) To exit gauss give the command quit

A simple Gauss program

Once in Gauss give the commands:
x = { 1 2, 3 4, 5 6, 7 8};
print x;

This should print out a 4 x 2 matrix with first row 1 2, second row 3 4, third row 5 6 and fourth row 7 8.

The next step

Go through most of chapter 1 (language fundamentals) and chapter 2 (operators).

The Gauss manual is written for DOS rather than Unix. So some minor changes need to be made. Also since we are only using a text rather than graphics interface some changes need to be made. Important ones include:

Entering Data

Data should initially be in an ascii (or text) file. Once read into Gauss it should be converted into a Gauss data set, which consists of two files, one with a .DAT extension (the data) and one with a .DHT extension (the names for the columns of the data set).

A simple way to do this is to read the ascii data using the load command.
For example, suppose there are 6 observations (rows) and 4 variables (columns) in the ascii file named rawdata. First use the load command to read the ascii data into a matrix:
load x[6,4] = rawdata;
and then use the saved procedure to create from this matrix a Gauss data set called mydata:
call saved(x,"mydata",0);

For more complicated ascii files use the Gauss Utility ATOG386.
For details, see the relevant chapter in Volume I of the Gauss manual.

A simple way is to use the data conversion program DBMSCOPY. This will convert e.g. SAS data sets to Gauss data sets. (DBMSCOPY is a separate program unrelated to Gauss).

Storing and Printing Results

Gauss will print output on the screen. Use the Gauss command output to save output for later use and printing. For example,
output file = myfile.out reset;
The option reset is used to clear the file of any earlier contents.

When you exit gauss the output will be in your directory in file myfile.out. This can be edited, e.g. using pico, and printed out in the usual way.

Running Gauss in Batch in Unix

To date I have considered interactive use of Gauss. Now suppose the file myprog.src is a Gauss program file. Then this can be run by giving the command at the Unix prompt:
gauss -v myprog.src

A simple way to run Gauss in batch mode is to run through a cycle of three commands

You can use the up arrow key to save having to retype these commands.

Useful Unix commands include ls which lists the directory, cp to copy a file, and rm to remove a file.