home | schedules | software | help | who we are | about | workshops | links | data access | contact us | print version

<  October 2009 >
Su Mo Tu We Th Fr Sa
        1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Reserve a classroom


Schedule for
10/07/2009


Main Lab
140 Prospect St.
Room 101
2:30- 3:45pm Stat 360/361
4- 5pm STAT 661

Rosenkranz Hall
115 Prospect St.
Room 01
No Events Today

Consultant's Desk
140 Prospect St.
Room 100
10am- 2pm Dan Campbell
2- 6pm Jennifer Green
6- 10pm Kyoung Hee Kim


schedules

software

help

who we are

data access

about

workshops

links


Regression Analysis of Time Series (RATS)

WinRATS (distributed by ESTIMA) is available on the STATLAB_NT network.

To Start WinRATS
Double-Click on the WinRATS Icon in the Applications folder.

To run RATS in batch mode
Give your RATS program file the extension ".prg". Click on File>open to open this file. Click on the window in which this file is opened to make the window active. Click on File>Clear Program, then click on the ALL Icon on the top of the toolbar. Click on Window>Use for input to make sure the Run Icon is blue. If not, click on the L/R Icon to make it under "R/L" situation. Finally click on the Run Icon to run the program file.

To Exit RATS
Click on File>Exit.

Writing a RATS program file
A RATS program file usually consists of three parts:

1. Data
To read data from an external file, you must open the file as data unit. You can do this by the instruction:
  • OPEN DATA filename

The critical instruction in reading the data is DATA. You need to tell RATS the names of the variables in the data set in order to use this command. There are two important options associated with the DATA instruction: FORMAT and ORG. RATS allows you to keep your data in a wide range of formats, from flat ASCII files to Lotus or Excel spreadsheets, as well as RATS' own database format. You need to specify your original data format using the FORMAT option of DATA. Data sets can be arranged logically in one of the two ways: each row (or possibly set of rows) represents one observation for all series, or each row (or possibly set of rows) represents all observations for one series. RATS calls the first type organized by observations, the second organized by variables. You must specify explicitly the type using the option ORG (short for ORGNIZATION):
  • ORG=OBS(OBSERVATION) for the first type,
or,
  • ORG=VAR(VARIABLE) for the second type.

Example:
	open data fooddata.dat
	data(format=free org=obs) / foodcons foodprod dispinc prretail 
This will open an ASCII format (or free-format) data file "fooddata.dat" and the RATS will know that each column of the data set represents one series of variable.

Although RATS is also useful for manipulating cross-section and panel (pooled) data sets, it emphasizes the analysis of time series data. For time series data sets, you need to tell RATS the frequency and the starting point of the data. This is done with the instruction CALENDAR (or CAL for short). CALENDAR should be the first instruction in any program which uses a regular time series data set. For instance,
	calendar 1955 1 12	(monthly data beginning January 1955. 
				 12 is the fixed number of entries 
				 per year for monthly data).	

	cal(daily) 1986 1 6	(daily data beginning Jan 6, 1986)

You also need to tell RATS how long the series are or alternatively, when the series end. This is done by the instruction ALLOCATE. It usually takes the form:
	allocate 0 length
where length is the maximum length of the data series. Note that if you are going to be doing any forecasting length should include the forecast interval.

The following is an example of opening and describing the time series data to RATS:
	calendar 47 1 4		(quarterly data beginning the first  
				 quarter of 1947)
	allocate 0 85:3		(ending the third quarter of 1985)

	open data "c:\temp\citidata.rat"
 	data(format=rats,org=obs) / gdp m1 int infl

2. Regression
RATS is very efficient in analyzing the time series data, from the usual OLS to the very complicated jobs like Vector Autoregressoin or bootstrapping. You can follow the relevant instructions in the manual. You can also find some very good program ming examples in the manual which you can easily adopt in your own project.

3.Graphics
RATS has three graphics instructions: GRAPH, PLOT, SCATTERPLOT.
Example:
	graph(header="U.S. GDP from 1947-1995") 1
	#gdp
This will give us a graph of U.S. GDP series. The "1" in the instruction indicates the number of series on the graph. The name of the variable (gdp in the example) should be specified after the # sign.

PLOT has the same basic form as GRAPH, though with much fewer options.

SCATTERPLOT does plots of x versus y. You just need to specify the x,y pairs after the # sign. For instance,
	scatterplot 1
	#gdp unemployment
This will plot the single pair (1 on the instruciton) with x=GDP and y=UNEMPLOYMENT.

For more advanced graphic techniques, read the third chapter of the manual.

Other Resources
ESTIMA's Guided Tour of the RATS software is a great place to get help and information on RATS.

lm: June 28, 1999