rndseed 345346;
x = rndn(100,5);
y = rndu(100,1);
output file = ols_output.txt reset;
call ols("",y,x);
output off;
print;
print "Results of this run stored in ols_output.txt file";
print "The file will be found in your working directory";
The first thing to notice is that each line ends with a semi-colon (;), like the C language does, which serves the same function as the dollar sign ($) does in LIMDEP. To run any statistical routine, we need data, and in this example we create a random data set. rndseed just creates a seed for the following random number generation so don’t worry about it. The next two lines create two matrices of (pseudo) random standard Normally distributed numbers. x = rndn(100,5); creates a 100 random observations of five normal variables, while y = rndu(100,1); does so for one random variable. Thus for the command rndn, the first element in the parenthesis tells GAUSS how many rows (observations) to create and the second element tells it how many columns (variables) to make. The next line, output file = ols_output.txt reset;, tells GAUSS where to put the output (in this case the present working directory) command). The main part of this program is call ols("",y,x); tells GAUSS to get its routine for estimating ordinary least squares, the call ols part, while the stuff in the parentheses tells GAUSS what dataset to use (the “” says that it should use the stuff that was just created), what is the response variable (y), and what are the predictor variables (x). output off; tells GAUSS not to send the output of the regression to a another auxiliary file (using on instead of off and putting a file = directory path after output will create such a file). The print commands are self-explanatory.
|