This documentation explains how to run TSP 4.4 on strauss. TSP stands for Time Series Processor. It is a statistical package designed for econometric analysis. It contains many time-series procedures such as ARIMA, and ARCH and GARCH models and many other statistical methods including OLS, 2SLS, 3SLS, PANEL, principal components, and nonlinear least squares.
The program tsp is available in /opt/bin/tsp
. You can access
it by typing tsp
at the unix prompt.
The simplest way to run TSP is to place your TSP commands in
a command file with an extension of .tsp
or .TSP
,
for example, testrun.tsp
.
Example 1: Data in the Command File
Here is a sample TSP command file containing data. The program reads
the data, prints it, calculates descriptive statistics
(msd
), and does a least-squares regression
(olsq
). The command file is named
testrun.tsp
; its contents are
read x y z; 1 2 3 7 0 2 1 5 9 3 6 2 8 1 4 6 0 2 5 5 1 1 7 8 2 2 2 4 3 7 ; print x y z; msd x y z; olsq x y z;
To run TSP using this command file, type
tsp testrun
The system automatically adds the .tsp
extension to the
file name.
The output is written to a file with the same root name as your command
file and an extension of .out
or .OUT
, in this
example --
testrun.out
To view this file on your screen, type
more testrun.out
at the unix prompt. It is convenient to open at least two windows
on strauss for these operations. Use one of them to edit your command
file using a UNIX editor such as pico
or vi
.
Use the second window to type the tsp
command and view the
output.
If the first character in the command file name is an upper case
letter, then the extension on the output file is in upper case. For
example, if your command file were named TestRun.tsp
, the
output file would be named TestRun.OUT
.
Example 2: Reading Data from an External Data File
This example is the same as Example 1, except the data are
not included in the command file. The command file is named
testrun2.tsp
; its contents are
read(file='test.data', format=free) x y z; print x y z; msd x y z; olsq x y z;
Here the data are stored in a file external to the TSP command file.
The contents of the data file, here named test.data, are
1 2 3 7 0 2 1 5 9 3 6 2 8 1 4 6 0 2 5 5 1 1 7 8 2 2 2 4 3 7
This is the same data as appeared inside the command file for Example 1.
For small data sets, it is convenient to keep data in the command file, but for large data sets it generally is not.
To run this program, type
tsp testrun2
The output will be stored in testrun2.out
.
To print the output on the Smith Hall printers, type
lpr testrun2.out
To print at another site, use the -P
flag followed
by the name of the printer queue, for example, type
lpr -P whlps testrun2.out
A list of printer names is available online.
The output file contains a copy of your commands. So you need not print the command file.
If the data are stored in a directory other than the current
working directory, then you must include the full path of
the file in the file=
option. For example
file='/home/usra/00/01234/data/inc.data'
TSP does not recognize a ~; neither does it recognize
environment variables like HOME
.
Alternatively, you may establish a symbolic link using the
ln
command. For example, suppose you wish to read a file
in Professor Zing's data directory. If Professor Zing's username is
zing, and the data file is
~zing/data/probit.data
you may establish the link by typing
ln -s ~zing/data/probit.data probit.data
at your UNIX prompt, then access the file in TSP with the command
read(file='probit.data', ...) ...
If you expect to use many files from Professor's Zing's data directory, you may set up a link to the directory
ln -s ~zing/data zing
Then, to read a file called zingstdy.data
in this directory,
use
read(file='zing/zingstdy.data',...) ...
Interactive TSP sessions are supported on strauss. To start an interactive session, simply type
tsp
at your UNIX prompt. You may type commands and enter data just as you do in a command file. The TSP prompt is
<line number> ?
For example, your first prompt will be
1 ?
Terminating commands with semicolons usually is not required when entering interactive TSP commands.
There are several commands to end your interactive session:
end, quit, q, exit
and stop
.
Saving Your Work
To save the output of your commands in a file for later viewing or printing, type the output command
output 'filename'
Substitute any valid UNIX file name for filename. If filename has no extension, for example
output 'regress'
TSP appends a .out extension, so the file will be called
regress.out
. But, if you do include the extension, for
example
output 'regress.lst'
then the output filename will have the extension you give;
in this case the output filename is regress.lst
.
If the output file already exists, the output command causes it to be overwritten, but the TSP Reference Manual states that new output will be appended to the existing file! So, be careful!!
While the output command is active, your results are NOT displayed on your screen. To restore the display on your screen, type
terminal
This command halts writing results to the file and resumes the screen display.
You can save your data by typing
save
or
save filename
You may substitute for filename
any valid UNIX
file name.
If you use the first form, your data are saved in a file called
TSPSAV.SAV
. If you use the second form, your data are saved in
a file called filename.SAV
. TSP adds the SAV
extension if you don't include it in the name. (The save file has a
"binary" format which you cannot read.)
To retrieve the data in a later interactive TSP session, type
restore
or
restore filename
Use the first form if you used the first form of the save command, and second form if you used the second form of the save command.
A TSP system data set, called a databank
, can be saved with
out filename
and retrieved with
in 'filename'
The databank
files are saved with a .TLB
extension. Only data that have changed since the out
command was issued are saved!! So, for example
out 'testdat'; read x y z; 1 2 3 4 5 6 7 8 9 ; quit;
will save the three variables, x, y, z
, to the file
testdat.TLB
. BUT, reversing the order of the out
and read
commands prevents creation of the
databank
read x y z; 1 2 3 4 5 6 7 8 9 ; out 'testdat'; quit;
A major advantatge of the databank
is that you can use a
batch file to create one. The save file can only be created
with a save
command during an interactive session.
The TSP User's Guide and Reference Manual are available online in postscript and pdf formats.
If you need help quickly, you may call the IT Help Center at 831-6000 between 8 a.m. and 5 p.m., Monday through Friday. Or, you can submit a question through e-mail.