GAUSS
 Application Modules available in GAUSS for Windows
 Constrained Optimization
 CurveFit
 Descriptive Statistics
 Linear Programming
 Loglinear Analysis
 Maximum Likelihood Vers.4
 Nonlinear Equations
 Optimization
 Quantal Response
 Time Series
Using GAUSS (General)
GAUSS for Windows can be used in either the "interactive" or "batch" mode. In the "interactive" mode Gauss will execute a single command at a time as the user types them after a (gauss) prompt followed by the <ENTER> key. The output to these command will appear in the GAUSS Window as they are executed. This mode is often convenient when the user has a simple task at hand. The disadvantage of this is you do not have a hard copy of the commands executed and all that appears in the GAUSS Window will be lost once you exit GAUSS. This guide is primarily set up to help user in interactive mode.
In the "batch" mode the user creates a file containing a series of commands using an external text editor or the GAUSS Editor. One will then get GAUSS to execute the entire command file. To use GAUSS in this mode:
 Double click the "GAUSS" icon as in item 1 below.
 After the >>
promt that appears in the Command Window, type "edit"
followed by the filename as shown below:
>> edit c:\user\Filenam.prg; <Enter>
You can end the file with any suffix, typically one adopts a suffix that suggest to the viewer the content of the file, in this case a program file.
 A GAUSSEdit window will appear. You may begin enter
the GAUSS commands mentioned in the rest of this guide ignoring the
>> prompt. For example as in item 3.
x=1,2,3,4,5; print x;
After you have entered the desired GAUSS commands, click on the SAVE button on the top left corner of the GAUSSEdit window. The SAVE and EDIT buttons apply to the lower box bearing the name of your program file.  To execute this command file, go to Action in the menu bar, and then choose "Run current file".
 You can augment the commands in your program file
by opening the saved file from File>Open. The GAUSSEdit window
will reappear. Continue adding new commands to this program file as
suggested by the rest of this help sheet, each time typing only the
commands and ignoring the >> prompt.
Getting started in GAUSSNotation:
<F2> denotes a keyboard key; for example, <F2> denotes the function key F2. >> denotes the Gauss prompt; it appears on the screen automatically in command mode. >> command denotes a Gauss command. 
GETTING INTO GAUSS
Click the "GAUSS" icon in the "Applications" group. 
GETTING OUT OF GAUSS
Choose File > Exit from the menu. 
ONLINE HELP
Gauss has a quite comprehensive online help facility. Click the Help icon on the GAUSS menu to access it. 
ENTERING GAUSS COMMANDS
After the Gauss prompt (>>), start writing Gauss statements. End each with a semicolon. Hitting <Enter> will execute them. For example:>> let x=1 2 3 4 5; print x; <Enter>
Gauss does not care where you put spaces (with only a few exceptions), whether you have any blank lines, or case (upper case/lower case). 
THE GAUSS EDITOR
You can either use the editor which comes with Gauss or use any other Windows editor to do your programming (see the Accessories Group in Windows).In GAUSS, start the editor with: File >New. Enter a file name in the window, and an Edit window is created. When you execute GAUSS from an Edit window, the entire file is executed. This is the equivalent of the GAUSS "run filename" statement.

PRINTING OUTPUT ON THE SCREEN
Use the print command, followed by the line you want to print. In fact, you can leave out the word PRINT. So, the commands>> print x ; >> x ;
have the exact same effect: they both print the vector x on the screen. The format of the output can be changed by using the format command. The command takes two scalar arguments, the first of which is the total width allocated to each number, and the second is the number of places beyond the decimal (and including the decimal). For example:>> format 8,2 ; >> x=3.2345; >> x; will produce 3.2
If we then do>> format 16,8 ; >> x; we get 3.2345000 You can also print characters: >> print "I love Gauss.";

PRINTING OUTPUT TO A PRINTER
Gauss 3.5 now allows printing directly to the printer, which is an added new feature. Go to File>Print to print the active file or selected text from the active window. 
PRINTING OUTPUT TO A FILE
Use the output command to specify the file you want the output to go to:>> output file=outfile.out reset ;
"outfile.out" is the name of a file in the current directory, which you can choose. The word reset at the end means that any existing outfile.out file will be overwritten. If you want output to be appended to the end of the existing file, replace reset with on.Once you specify an output file, the output of every print command will go to this file. You can turn this feature on and off at any point in your program. For example, if there is a matrix you want printed to the screen but not to the output file, you can type:
>> output off ; >> print X ; >> output on ;
You can do the same with screen output. The commands screen on and screen off will switch output to the screen on and off respectively. The default is on. 
LOADING AND SAVING DATA
 ASCII (plain text) data files
 You can read data from ASCII (plain text)
files using the load command. The syntax is as follows:
>> load x[N,K]=datafile.asc;
This will read in N*K observations from your dataset and put them in an NxK matrix, REGARDLESS of how many observations you actually have in your dataset. If you omit the matrix dimensions, Gauss will read ALL the data in your file, and put them in a COLUMN VECTOR. You can then use the reshape command to put your dataset back in its original form:>> X=reshape(x,N,K);
Note that in order to do this without messing up your data you have to be sure you know how many observations, rows, and columns your dataset has.To save data in a text file, you need to declare an output file, and then use the print command to save your data in that file (see the setion on output files).
 Gauss matrices
 Once you have a matrix you know you will
need to use over and over again, you can store it as a Gauss
matrix. The command
>> save path = c:\users\ x ;
saves matrix x into the c:\user directory under the filename x.fmt. This is not a text file; it is written in a format only Gauss can read. Subsequent save commands without the path statement will automatically direct the fmt files to this directory. To use that matrix again, you can load it simply by typing>> load path=c:\users\ x ;
Gauss will look for file named x.fmt in the specified directory. If it finds it, it loads it as matrix x. Again subsequent load commands without the path statement is automatically directed to the preciously specified directory.  Gauss datasets
 Gauss datasets are useful because you can
store the variable names along with your data. Like Gauss matrices,
Gauss datasets can only be read by Gauss. To save a matrix as
a Gauss dataset, use the command
>> x = rndu(100,2); /* generates a (100x2) matrix of uniform nos */ >> let vnames = Tom Jerry; >> saved(x,"c:\user\xdata",vnames) ;
 This will create two files, one called xdata.dat,
which contains the data from matrix x, and one called
xdata.dht, which contains the variable names as entered
in vnames which in this case is 'Tom' and 'Jerry'.
Both these files are saved to the c:\user directory.
If you don't have the variable names, you can type 0
instead of vnames. The variables in that case will
be named X1 and X2.
Notice the double backward slashes is needed to specify the path within the quote keys. To print the names of the variables, a prefix of $ is needed to ensure GAUSS treats vnames as a vector of characters, that is:

>> print $vnames;
To load the dataset, use the following commands:>> open f1 = c:\user\xdata ; >> x = readr(f1,rowsf(f1)) ; >> vnames = getname("c:\user\xdata") ; The first command opens the dataset; the second one reads the entire dataset into the matrix x, and the third one gets the variable names. If you only want to read the first M observations, replace rowsf(f1) with M.
If you have a "small" dataset, you can load it using
x = loadd("c:\user\xdata") ;

GRAPHICS
In order to create graphs, you need to first invoke the pqraph library:>> library pgraph;
This makes the graphic utility available. For example, you might try:>> xy(x,y); >> hist(x,v);
The first command plots a graph with the vector x on the horizontal axis and the vector y on the vertical axis. The second command plots a histogram using the observations in the vector x and the breakpoints in vector v.The way your graph will look is controlled by a number of global variables. For example, the variable _plctrl determines whether the points on your xy plot will be connected or not. If _plctrl=0 (which is the default), the points will be connected. If you want a scatterplot, the you can set _plctrl=1. There are many other such variables which control things like the format and thickness of the lines, the number of ticks, legends, and so on. They are explained in Chapter 13: Publication Quality Graphics in the Gauss manual.
GAUSS for Windows displays the graph in a seperate window. To print the graph, use File > Print in the menu.
Attention: There is still a bug in the program (Vers. 3.2.25), that grays out the Print option in the Graph windows, until you click with the mouse somewhere in the command window!

BASIC MATHEMATICAL OPERATORS
+  * These perform in the standard way on scalars (add, subtract, multiply, divide). On matrices, +, , and * have the standard definitions. / is essentially equivalent to right division by a matrix inverse. .* ./ These perform elementbyelement multiplication and division of matrices. ^ This does elementbyelement exponentiation (raising to a power) of the elements of a matrix (.^ is equivalent). 
USEFUL MATRIX OPERATORS
~ Concatenates horizontally (sidebyside).  Concatenates vertically. ' Transposes a matrix. sortc(x,c) Sorts the matrix x with respect to the variable in column c of the matrix. 
SOME BASIC MATHEMATICAL AND STATISTICAL FUNCTIONS
cols(x) Returns the number of columns in matrix x. rows(x) Returns the number of rows in matrix x. exp(x) Raises e to powers given by elements of x. ln(x) Natural log of all elements of x. log(x) Log base 10 of all elements of x. sqrt(x) Square root or each element of x. meanc(x) Mean of each column of x. stdc(x) Standard deviation of each column of x. sumc(x) Sum of each column of x. vcx(x) The variancecovariance matrix of the variables in x. corrx(x) The correlation matrix of the variables in x. 
SOME FUNCTIONS FOR DEFINING MATRICES
eye(K) The KxK identity matrix. let Allows matrices to be defined explicitly: let x[2,2]=1 8 12 5 ; /* a 2x2 matrix */ let x=1 5 6 8 ; /* a 4x1 vector */ let x=dog cat ; /* a 2x1 matrix with character elements */
ones(N,K) NxK matrix of ones. zeros(N,K) NxK matrix of zeros. seqa(s,c,N) NxK sequence of N numbers, starting with s, and with increment c. rndn(N,K) NxK matrix of draws from the standard normal distribution. rndu(N,K) NxK matrix of draws from the uniform distribution. 
INDEXING THE ELEMENTS OF A MATRIX
x[i,j] the element in row i, column j of x. x[i,.] the entire row i of x. x[.,j] the entire column j of x. x[1:m,j] rows 1 through m of column j of x. x[i m,j l] rows i and m; columns j and l. x[rv,cv] the rows and columns specified in vectors rv and cv respectively. 
COMMENTS
There are two ways to add comments to your program:/* comments */ @ comments @ The first type of comment can be nested; the second can not.

FLOW CONTROL
do until (condition); [commands]; endo ; do while (condition); [commands]; endo ; Example: i=1; do while i<10 ; i=1+1; endo; if (condition) ; [commands]; elseif (condition); [commands]; ... else; [commands]; endif ; Example: if x==0; print "x is 0"; elseif x==1; print "x is 1"; else; print "x is neither 1 nor 0"; endif ;

 Other Resources
lm: September 19, 2001