rats dialog interface n.
Skip this Video
Loading SlideShow in 5 Seconds..
RATS Dialog Interface PowerPoint Presentation
Download Presentation
RATS Dialog Interface

RATS Dialog Interface

120 Vues Download Presentation
Télécharger la présentation

RATS Dialog Interface

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. RATS 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 <CTRL F6> Preparing the Data

  2. RATS Dialog Interface: II LOCAL MODE: <Ctrl L> 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 <Ctrl L> 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 <CTRL X> is equivalent to Cut, <CTRL C> is equivalent to Copy, and <CTRL V> 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. Preparing the Data

  3. RATS 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!). Preparing the Data

  4. Preparing 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 1959:1 – 2001:1. Both interest rates are expressed as annual rates and the other variables are in billions of dollars cal 1959 1 4 all 2001:1 open data c:\money_dem.xls data(org=obs,format=xls) Preparing the Data

  5. Calendar calendaryear period frequency or cal(q) 1959:1 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. Preparing the Data

  6. Calendar 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)year:1       Annual calendar(q) year:quarter       Quarterly calendar(b)year:month:day      Biweekly calendar(w)year:month:day     Weekly calendar(d)year:month:day      Daily (5/week) calendar(7)year:month:day      Daily (7/week) Preparing the Data

  7. Allocate • 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 1990:4. For monthly data ending with December 1990, use allocate 1990:12. Preparing the Data

  8. Open and DATA The OPEN and DATA statements are used together. data(format=xls,org=obs) 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) 1960:1 all 2012:4 open data quarterly(2012).xls data(org=obs,format=xls) Preparing the Data

  9. Form 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 Preparing the Data

  10. Sample Statistics • Table • table(picture="*.##") • statistics Tb3mo • table / tb3mo tb1yr • print / tb3mo tb1yr Preparing the Data

  11. SET setseries 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. Preparing the Data

  12. SET: II • RATS allows you to use braces { } as a shorthand way to represent time subscripts; you can use series{lag} in place of series(t-lag). Examples: • Instead of using y(t-1), you can use y{1}. 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(t+2) 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 y{1 to 4} indicates the first four lags of ja. Preparing the Data

  13. Set: III • set dlrgdp = log(rgdp) - log(rgdp{1}) • set dlm2 = log(m2) - log(m2{1}) • set drs = tb3mo - tb3mo{1} • set dr1 = tb1yr - tb1yr{1} • set dlp = log(deflator) - log(deflator{1}) • set dlppi = log(ppi) - log(ppi{1}) Preparing the Data

  14. Set: 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 Preparing the Data

  15. Graph GRAPH(Options) number # series start end symbol choice (one for each series) number: number of series to graph Options STYLE=[LINE]/POLYGON/BAR/STACKEDBAR/OVERLAPBAR/ VERTICAL/STEP/SYMBOL PATTERNS/[NOPATTERNS] HEADER='string' SUBHEADER='label‘ HLABEL='label' VLABEL='label‘ NODATES (RATS will label the horizontal axis unless the NODATES option is specified.) KEY=[NONE]/UPLEFT/UPRIGHT/LOLEFT/LORIGHT/ABOVE/BELOW/ LEFT/RIGHT OVERLAY=[LINE]/POLYGON/BAR/STACKEDBAR/OVERLAPBAR /VERTICAL/STEP/SYMBOL OVCOUNT=Number of series for right-side scale [1] Preparing the Data

  16. Examples graph(header="The Interest Rates",key=below) 2 # tb3mo ; # tb1yr graph(hea="Real and Potential GDP",key=upleft) 2 # rgdp ; # potent Preparing the Data

  17. Multiple Graphs per Page SPGRAPH(hfields= ,vfields= ,header = ‘ ‘ , subheader = ‘ ‘) : Spgraph(Done) Example: SPGRAPH(HFIELDS=2,VFIELDS=2) Graph 1 # x1 …. Graph 1 # x4 SPGRAPH(DONE) Preparing the Data

  18. spgraph(footer="Graphs of the Series",hfields=2,vfields=2) graph(header="Panel 1: The Interest Rates",key=below,nokbox) 2 # tb3mo ; # tb1yr graph(header="Panel 2: Real and Potential GDP",key=upleft) 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) Preparing the Data

  19. Scatter 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. Preparing the Data

  20. Linear Regression Suppose you want to estimate the regression lin drs / resids # constant drs{1 to 7} Preparing the Data

  21. LINREG 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. Preparing the Data

  22. Linear Regression - Estimation by Least Squares Dependent Variable DRS Quarterly Data From 1962:01 To 2012:04 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. DRS{1} 0.390010248 0.069644459 5.60002 0.00000007 3. DRS{2} -0.380186642 0.074718282 -5.08827 0.00000084 4. DRS{3} 0.406843358 0.078304236 5.19567 0.00000051 5. DRS{4} -0.159123423 0.082740231 -1.92317 0.05590809 6. DRS{5} 0.193334248 0.078290297 2.46945 0.01438724 7. DRS{6} -0.089946745 0.074692035 -1.20423 0.22995107 8. DRS{7} -0.220768119 0.069358921 -3.18298 0.00169542 Preparing the Data

  23. LINREG: 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 Number 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 Preparing the Data

  24. Correlations 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. Preparing the Data

  25. 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. 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(number=12,partial=partial,qstats,span=4) resids Preparing the Data

  26. Restrictions 1. Exclusion and Sum Restrictions Examples: exclude # drs{5 to 7} exclude # constant drs{5 to 7} summarize # drs{5 to 7} Preparing the Data

  27. TEST: 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 Preparing the Data

  28. Restrict 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 Preparing the Data

  29. Restrict: II Examples 1. To test the joint restriction that a2 + 2a3 = 0 (i.e., 1.0*a2 + 2.0*a3 = 0), use: restrict 1 # 2 3 # 1 2 0 2.To test the joint restriction that a2 + 2a3 = 0 (i.e., 1.0*a2 + 2.0*a3 = 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 Preparing the Data

  30. Forecast 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. Preparing the Data

  31. Forecast: II Example: lin(define=eq1) rcons 1947:1 1997:2 resids # constant trend t3 t4 t5 forecast(print) 1 12 1997:3 # eq1 fore Preparing the Data