Information and results of a session are stored in a GAUSS .fmt
file on the disk. This file is generated using the VPUT command,
and VLIST and VREAD commands can be used to inspect and
retrieve session information.
The name of the session file is the session label used in declaring
the session. Thus
session ses1 "portfolio analysis";
directs FANPAC to store session information into a file called
ses1.fmt on the disk in the current directory. Invoking
the session command initializes a set of arrays stored
in that matrix. For example, the following sequence of GAUSS
commands produces a list of the contents:
(gauss) loadm ses1
(gauss) vlist(ses1)
Name 4 character string
Runs scalar
title 18 character string
dataset scalar
Series scalar
IndVars scalar
Range scalar
Scale scalar
version 3x1 vector
date 19 character string
Most of the entries are scalar missing values because nothing
has been done yet.
Suppose we estimate a couple of models:
(gauss) setDataSet stocks
(gauss) setSeries SUNW
(gauss) computeLogReturns 251;
(gauss) estimate run1 garch(3,2)
(gauss) estimate run2 tgarch(3,2)
And now let's look at the contents of ses1.fmt:
(gauss) loadm ses1
(gauss) vlist(ses1)
Name 4 character string
title 18 character string
IndVars scalar
Scale scalar
version 3x1 vector
date 19 character string
dataset 6 character string
Series scalar
Range 2x1 vector
run1 224x1 vector
Runs 2x1 vector
run2 244x1 vector
You may have noticed that there are two vectors in ses1 with
the same names as the labels in the estimations. These are matrices
generated using the VPUT command containing all the information
about the estimations. To retrieve this information, first
extract the vector from ses1 and then vlist it:
(gauss) r1 = vread(ses1,"run1")
(gauss) vlist(r1)
name 4 character string
title 0 character string
model 5 character string
p scalar
q scalar
d scalar
indvars scalar
TSfcst scalar
CVfcst scalar
IndEqs scalar
CVIndEqs scalar
ParNames 7x1 vector
ParList 7x1 vector
NumObs scalar
Estimate 7x1 vector
AIC scalar
BIC scalar
LRS scalar
RCode scalar
CovType scalar
InfType scalar
CovPar 7x7 matrix
PDCovPar scalar
CLimits 7x2 matrix
[Note: for descriptions of the contents of this vector, as well as of
the entire contents of the session matrix, see Appendix A.]
The keyword command ShowResults retrieves the information stored
in this vector when it prints results to the screen.
For your own purposes you may want to design your own output,
and this matrix will be most useful for this purpose.
For example, suppose you would like to evaluate the fit of a
series of GARCH models with different orders. The following
could be run from a command file:
library fanpac;
session ses2 "test of order";
setDataSet stocks;
setSeries SUNW;
computeLogReturns 251;
/*
** Estimate a series of GARCH models
*/
numP = 3;
numQ = 3;
i = 1; do until i > numP;
j = 1; do until j > numQ;
is = ftos(i,"*.*lf",1,0);
js = ftos(j,"*.*lf",1,0);
s0 = "run" $+ is $+ js $+ " garch(" $+ is $+ "," $+ js $+ ")";
estimate ^s0;
j = j + 1; endo;
i = i + 1; endo;
/*
** Retrieve and store in a matrix the BIC statistics
*/
loadm ses2;
runs = vread(ses2,"Runs");
bic = zeros(numP,numQ);
k = 1;
i = 1; do until i > numP;
j = 1; do until j > numQ;
rk = vread(ses2,runs[k]);
bic[vread(rk,"p"),vread(rk,"q")] = vread(rk,"BIC");
k = k + 1;
j = j + 1; endo;
i = i + 1; endo;
/*
** Print the BIC statistics
*/
print " Q";
print "P";;
format /rd 9,1;
print seqa(1,1,numQ)';
i = 1; do until i > 3;
format /ld 1,0;
print i;;
format /ld 9,4;
print bic[i,.];
i = i + 1; endo;
Q
P 1 2 3
1 1973.3754 1973.3339 1972.4407
2 1974.2399 1980.2288 1978.0922
3 1971.7377 1977.6298 1982.1088