Title: RATS Dialog Interface
1RATS Dialog Interface
WINDOWS It is most convenient to use RATS using
two windows one for input and the other for
output. When you begin RATS, the ACTIVE, OUTPUT,
and INPUT are identical. This Window is
NONAME00.TXT If you open a second window
without closing NONAME.TXT the new window will
become the ACTIVE window, but not the input or
output window. If yow want to use this new
window for input and/or output, use the
Window-Use for Input or the Window-Use for Output
commands listed on the WINDOW menu. The
Window-Tile command, makes the multiple windows
visible. You can switch between windows using
the mouse, menu or using ltCTRL F6gt
2RATS Dialog Interface II
LOCAL MODE ltCtrl Lgt Allows you to enter
commands or instructions, without execution
taking place. Thus, you can use RATS as a
wordprocessor. This is a toggle the second
ltCtrl Lgt returns you to ready mode. SELECT
TEXT CUT, COPY, PASTE Use the mouse or use the
SHIFT key in conjunction with the arrow keys or
the PgUp or PgDn keys to mark text. Marked text
can be cut, pasted, or copied using the EDIT
menu. Note that ltCTRL Xgt is equivalent to Cut,
ltCTRL Cgt is equivalent to Copy, and ltCTRL Vgt is
equivalent to Paste. COMPOUND
INSTRUCTIONS Certain instructions have
supplementary cards (e.g., the GRAPH Command).
If you make an error on a supplementary card, you
must reenter the entire instruction from the
beginning.
3RATS Dialog Interface III
ONLINE HELP You can get online help from the
HELP Pull-Down Menu. You can get help on the
specific RATS Instructions using the F1
key. PRINTING GRAPHS To print a graph, you
use the PRINT command from the FILE menu. RATS
will print only the material in the currently
shown window. As such, the graph window must be
shown on the screen. SAVING YOUR WORK It is
possible to save your program on to a disk using
the SAVE or the SAVE AS command on the FILE menu.
As such, you will not have to retype your
commands the next time you use RATS. Simply use
the OPEN command from the FILE menu to begin your
next session. (Be sure the new program is in the
active window!).
4Preparing the Data
The file labeled MONEY_DEM.XLS contains
quarterly values of seasonally adjusted U.S.
nominal GDP, real GDP in 1996 dollars (RGDP), the
money supply as measured by M2 and M3, and the
3-month and 1-year treasury bill rates for the
period 19591 20011. Both interest rates are
expressed as annual rates and the other variables
are in billions of dollars cal 1959 1 4 all
20011 open data c\money_dem.xls data(orgobs,f
ormatxls)
5Calendar
calendar year period frequency or cal(q)
19591 where year The year of the first
entry in the data set period The period of
the first entry in the data set frequency The
number of observations per year.
Examples For monthly data beginning with
February 1973, use calendar 1973 2 12. For
semiannual data beginning with July 1973, use
calendar 1973 2 2. For annual data it is
permissible to use only the starting year. As
such, you can omit the period and frequency and
use the more compact calendar 1973 instead of
calendar 1973 1 1.
6Calendar II
CALENDAR(DAILY) year month day Sets date
of first entry for business-day (5-day per week)
daily data. CALENDAR(PERDAY of periods)
year month day Sets starting date, frequency,
and the number of periods per day for intraday
data calendar(a) year1 Annual
calendar(q) yearquarter Quarterly
calendar(b) yearmonthday Biweekly calendar
(w) yearmonthday Weekly calendar(d)
yearmonthday Daily (5/week) calendar(7)
yearmonthday Daily (7/week)
7Allocate
- In older versions, it was necessary to use
ALLOCATE immediately following CALENDAR. However,
in new versions it is convenient, but not
necessary. - Examples
- For monthly data ending with April 1990 use
allocate 19904. - For monthly data ending with December 1990, use
allocate 199012.
8Open and DATA
The OPEN and DATA statements are used
together. data(formatxls,orgobs) start end
series where start end Range of entries to
read. series The list of series to read.
(If series is omitted, all variables in the data
set are read into memory) Notice the slash (/)
in the DATA instruction. In RATS, you can set
the range explicitly or use a slash to refer to
the default range. Example cal(q) 19601 all
20124 open data quarterly(2012).xls data(orgobs,
formatxls)
9Form of the Data Sets
DATE Tb3mo Tb1yr RGDP Potent Deflator M2
PPI Curr 1960Q1 3.87 4.57 2845.3 2824.2
18.521 298.7 33.2 31.8 1960Q2 2.99 3.87
2832.0 2851.2 18.579 301.1 33.4 31.9 1960Q3
2.36 3.07 2836.6 2878.7 18.648 306.5
33.4 32.2 1960Q4 2.31 2.99 2800.2 2906.7
18.700 310.9 33.7 32.6 1961Q1 2.35 2.87
2816.9 2934.8 18.743 316.3 33.6 32.1 1961Q2
2.30 2.94 2869.6 2962.9 18.785 322.1
33.3 32.1 1961Q3 2.30 3.01 2915.9 2991.3
18.843 327.6 33.3 32.7 1961Q4 2.46 3.10
2975.3 3019.9 18.908 333.3 33.4 33.4
10Sample Statistics
- Table
- table(picture".")
- statistics Tb3mo
- table / tb3mo tb1yr
- print / tb3mo tb1yr
11SET
- set series start end function(T)
- 1. A slash (/) or the omission of start end both
default to the maximum permissible range as
indicated on ALLOCATE. - 2. If you make a mistake, RATS will create
missing values instead of an error message
whenever possible. - THIS CAN BE A PROBLEM IF YOU ARE UNAWARE OF THE
MISTAKE! - You must use a space before and after the equal
sign. - RATS accepts addition (), subtraction (-),
multiplication (), division (/), and
exponentiation () using the usual order of
precedence. - ABS(X), EXP(X), LOG(X), and SQRT(X) are used to
denote the absolute value, exponential value
(i.e., ex), natural logarithm, and square root
of the argument X, respectively. - All levels of parentheses ( ) are supported but
you cannot use braces or brackets in
place of parentheses.
12SET II
- RATS allows you to use braces as a shorthand
way to represent time subscripts you can use
serieslag in place of series(t-lag). - Examples
- Instead of using y(t-1), you can use y1. The
number placed in the braces indicates the lag
number. - A negative number in braces indicates a leading
value of the variable so that y(t2) and y-2
are equivalent ways to write the second lead of
y. - Also, the notation A to B can be used to
indicate lags A through B so that y1 to 4
indicates the first four lags of ja.
13Set III
- set dlrgdp log(rgdp) - log(rgdp1)
- set dlm2 log(m2) - log(m21)
- set drs tb3mo - tb3mo1
- set dr1 tb1yr - tb1yr1
- set dlp log(deflator) - log(deflator1)
- set dlppi log(ppi) - log(ppi1)
14Set IV
- Shortcuts
- log y / ly
- difference y / y
- You must define the start end range or use the
slash (/) on the DIFFERENCE statement. Unlike
the SET statement, if you explicitly define the
range, you must allow for the number of lags
created. - exp y / ey
- seasonal seasons
- set trend t
15Graph
GRAPH(Options) number series start end
symbol choice (one for each series) number
number of series to graph Options STYLELINE/PO
LYGON/BAR/STACKEDBAR/OVERLAPBAR/ VERTICAL/STEP/SY
MBOL PATTERNS/NOPATTERNS HEADER'string'
SUBHEADER'label HLABEL'label'
VLABEL'label NODATES (RATS will label the
horizontal axis unless the NODATES option is
specified.) KEYNONE/UPLEFT/UPRIGHT/LOLEFT/LORIG
HT/ABOVE/BELOW/ LEFT/RIGHT OVERLAYLINE/POLYGON
/BAR/STACKEDBAR/OVERLAPBAR /VERTICAL/STEP/SYMBOL
OVCOUNTNumber of series for right-side scale 1
16Examples
- graph(header"The Interest Rates",keybelow) 2
- tb3mo tb1yr
- graph(hea"Real and Potential GDP",keyupleft) 2
- rgdp potent
17Multiple Graphs per Page
SPGRAPH(hfields ,vfields ,header ,
subheader ) Spgraph(Done) Example SPGRAP
H(HFIELDS2,VFIELDS2) Graph 1
x1 . Graph 1 x4 SPGRAPH(DONE)
18spgraph(footer"Graphs of the Series",hfields2,vf
ields2) graph(header"Panel 1 The Interest
Rates",keybelow,nokbox) 2 tb3mo tb1yr
graph(header"Panel 2 Real and Potential
GDP",keyupleft) 2 rgdp potent
graph(header"Panel 3 Time path of money
growth",noaxis) 1 dlm2 graph(header"Panel
4 Time path of Inflation",noaxis) 1
dlp spgraph(done)
19Scatter Diagrams
SCATTER(Options) pairs x-series y-series
start end The important options are the same as
those for Graph Instruction NOTE ON COMPOUND
STATEMENTS LIKE GRAPH AND SCATTER, IT YOU MAKE A
MISTAKE ON THE SECOND LINE, YOU MUST RE-ENTER THE
FIRST LINE.
20Linear Regression
Suppose you want to estimate the regression
lin drs / resids constant drs1 to 7
21LINREG
linreg(options) depvar start end residuals
list where depvar The dependent
variable. start end The range to use in the
regression. residuals (Optional) Series name for
the residuals. list The list of explanatory
variables.
22Linear Regression - Estimation by Least
Squares Dependent Variable DRS Quarterly Data
From 196201 To 201204 Usable Observations
204 Degrees of Freedom 196 Centered Rˆ2
0.2841953 R-Barˆ2 0.2586309 Uncentered Rˆ2
0.2843637 Mean of Dependent Variable
-0.011617647 Std Error of Dependent Variable
0.759163288 Standard Error of Estimate
0.653660810 Sum of Squared Residuals
83.745401006 Regression F(7,196)
11.1168 Significance Level of F 0.0000000 Log
Likelihood -198.6489 Durbin-Watson Statistic
1.9709 Variable Coeff Std Error T-Stat
Signif
1.
Constant -0.011903358 0.045799634 -0.25990
0.79521316 2. DRS1 0.390010248 0.069644459
5.60002 0.00000007 3. DRS2 -0.380186642
0.074718282 -5.08827 0.00000084 4. DRS3
0.406843358 0.078304236 5.19567 0.00000051 5.
DRS4 -0.159123423 0.082740231 -1.92317
0.05590809 6. DRS5 0.193334248 0.078290297
2.46945 0.01438724 7. DRS6 -0.089946745
0.074692035 -1.20423 0.22995107 8. DRS7
-0.220768119 0.069358921 -3.18298 0.00169542
23LINREG II
The most useful options are DEFINE Name the
equation by setting DEFINE NAME NOPRINT Do not
print the regression output. VCV Print the
covariance/correlation matrix of the
coefficients. LINREG creates a number of
variables that you can use in subsequent
computations. A partial list of these variables
is BETA The coefficient vector.
The first coefficient estimated is
BETA(1), the second BETA(2), and so on.
tstats NDF Degrees of freedom NOBS Numbe
r of observations. NREG Number of
regressors. RSS Residual sum of
squares. RSQUARED Centered R2 (i.e, the usual
measure of R2) SEESQ Standard error of estimate
squared
24Correlations
CORRELATE Calculates the autocorrelations (and
the partial autocorrelations) of a specified
series. The syntax and principal options
are correlate(options) series start end where
series The series used to compute the
correlations. start end The range of entries to
use. The default is the entire series. The
principal options are NUMBER The number of
autocorrelations to compute. PARTIAL Series for
the partial autocorrelations. QSTATS Use this
option if you want the Ljung-Box
Q-statistics. DFC Degrees of freedom correction.
SPAN Use with qstats to set the width of the
intervals tested. For example, with quarterly
data, you can set span 4, to obtain Q(4), Q(8),
Q(12), and so forth.
25correlate(options) series start end where series
The series used to compute the
correlations. start end The range of entries to
use. The default is the entire
series. corrs Series used to save the
autocorrelations (Optional). The principal
options are NUMBER The number of
autocorrelations to compute. The default is the
integer value of one-fourth the total number of
observations. PARTIAL Series for the partial
autocorrelations. If you omit this option, the
PACF will not be calculated. QSTATS Use this
option if you want the Ljung-Box
Q-statistics. SPAN Use with qstats to set the
width of the intervals tested. For example, with
quarterly data, you can set span 4, to obtain
Q(4), Q(8), Q(12), and so forth. In the example
at hand, we can obtain the first twelve
autocorrelations, partial autocorrelations (and
the associated Q-statistics) of the residuals
with cor(number12,partialpartial,qstats,span
4) resids
26Restrictions
1. Exclusion and Sum Restrictions
Examples exclude drs5 to 7 exclude
constant drs5 to 7 summarize drs5 to 7
27TEST Individual Coefficient Restrictions
2. Test This instruction contains three
lines TEST list of coefficients to be
restricted constants against which coeff. are
tested Example To test if beta(6) 0.1, beta(7)
0.1 and beta(8) 0., use test 6 7 8 0.1
0.1 0.0 To test the restriction that the
constant equals zero and that ?5 0.1, ?6 0.1,
and ?7 0.1, use test 1 6 7 8 0. 0.1 0.1
0.1
28Restrict
3. RESTRICT can test multiple linear restrictions
on the coefficients and estimate the restricted
model. Each restriction is entered in the
form ßiai ßjaj ... ßkak r where ai
are the coefficients of the estimated model
(i.e., each coefficient is referred to by its
assigned number). ßi are weights you assign to
each coefficient. r represents the
restricted value of the sum
29Restrict II
Examples 1. To test the joint restriction that a2
2a3 0 (i.e., 1.0a2 2.0a3 0),
use restrict 1 2 3 1 2 0 2. To test the
joint restriction that a2 2a3 0 (i.e., 1.0a2
2.0a3 0), use restrict 1 2 3 1 2 0 3.
restrict(create) 2 resids 5 6 7 8 1 1 1 1
0 2 3 1 -1 0
30Forecast
FORECAST Creates dynamic forecasts of a
previously defined equation. FORECAST uses a
supplementary card for each equation in the
system. In univariate forecasting, the typical
syntax for FORECAST is forecast(print) number
steps start equation forecasts where number
The number of equations in the system. In
univariate forecasting, number is necessarily
equal to 1. steps The number of forecasts to
create. start The starting period of the
forecasts. equation The name of the previously
defined equation. forecasts The name of the
series in which you want to save the
forecasts. This field is optional.
31Forecast II
Example lin(defineeq1) rcons 19471 19972
resids constant trend t3 t4 t5 forecast(print)
1 12 19973 eq1 fore