The RATS FAQ (Frequently Asked Questions)

Answers to Frequently Asked Questions about RATS

Home

RATS

CATS

All Products

Orders

Contact Us

Support

Procedures & Examples

News

Download Updates

Discussion Forums

Articles

Register or Change Address

Search

Answers to Frequently Asked Questions about RATS

The following is a list of commonly asked questions about RATS and other Estima products, along with the answers to those questions. The "Table of Contents" provides a quick listing of the questions covered in this FAQ. See below for the full Questions and Answers.

This list was last updated on: January 8, 2001

Latest Additions

Updates to several items to reflect changes in Version 5.


Table of Contents

How Can I....?

H1. How can I do a "rolling regression" in RATS?

H2. How can I copy values from a set of series into an array, or from an array into a set of series?

H3. How can I access the standard errors and t-statistics from a regression?

H4. Can I control the number of decimal places displayed by RATS (e.g. by PRINT or the regression instructions)?

H5. Can RATS do unit-root tests and cointegration analysis?

H6. Can RATS solve linear/quadratic programming problems?

Problems and Error Messages

P1. What does the message "## SR12. We recommend File-Clear Program or END xxx before ALLOCATE" mean?

P2. What do I do if I get a memory request error, such as "## M4. A memory request for an additional 64012 bytes cannot be satisfied"?

P3. I can't seem to execute instructions, or "Help, I'm in 'Local' mode and I can't get out!"

P4. I tried to use one of the RATS procedures, and got the error message: "## CP18. procname is not the Name of a PROCEDURE. (Did you forget to SOURCE?)" What does this mean?

P5. I'm having trouble using the regression lists created with the ENTER instruction, particular when I use lags in the regression list. What's going on?

P6. I can't read DBF format data files created in the Year 2000. Is this a Year 2000 Bug?

Miscellaneous

M1. Is RATS "Year 2000" compliant?


The Questions and Answers:

Q: H1. I want to do a "rolling regression" in a loop. Each time through the loop, I want to add one period to the end of the estimation range, keeping the starting date fixed. I also want to compute a one-step-ahead forecast for the next period, saving the one-step forecasts in a series. How do I do that?

A: H1. Update: WIth the release of Version 5, information on rolling regressions has been included in the RATS documentation See pages 118 and 251 in the RATS User's Guide for details. For those of you using an older version, or who want more information, please refer to the following:

This is very easy in RATS, if you remember that RATS allows you to use dates as loop indexes, and in expressions of the form "entry plus integer" or "date plus integer" (e.g., for monthly data, "1970:1 + 1" is equal to "1970:2"). The only tricky part here is that you must declare the series for the forecasts ahead of time (we'll use the CLEAR instruction for that).

Suppose you have monthly data for Y and X from 1970:1 through 1995:4. You want to regress Y on a constant and X, starting with the range 1970:1 through 1989:12, and accumulate forecasts (in a series called YHAT) for 1990:1 through 1995:5. The code would be:

CAL 1970 1 12 ALL 1995:4 OPEN DATA MYDATA.RAT DATA(FOR=RATS) / Y X COMPUTE REGSTART = 1970:1 CLEAR YHAT DO REGEND=1989:12,1995:4 LINREG(DEFINE=FOREEQ) Y REGSTART REGEND # CONSTANT X FORECAST 1 1 (REGEND+1) # FOREEQ YHAT END DO Suppose you wanted to modify this to estimate over a "moving window" of, say, five years, and you also want to save the estimated coefficients from each trip through the loop in a series. There are lots of ways to set that up, and here's one of them:

CLEAR YHAT COEF1 COEF2 DO STEP=0,245 LINREG(DEFINE=FOREEQ) Y (1970:1+STEP) (1974:12+STEP) # CONSTANT X COMPUTE COEF1(1974:12+STEP) = %BETA(1) COMPUTE COEF2(1974:12+STEP) = %BETA(2) FORECAST 1 1 (1975:1+STEP) # FOREEQ YHAT END DO

Q: H2. How can I copy values from a set of series into an array, or from an array into a set of series?

A: H2. The MAKE instruction takes a list of series and copies the data into a RECTANGULAR array. The section on MAKE in the reference section of the RATS Manual also shows you how to use SET to copy data from an array to a series. To copy data from a series into a VECTOR, we would recommend the EWISE instruction (assume X is a series and V is a vector):

EWISE V(I) = X(I)

Q: H3. How can I access the standard errors and t-statistics for regression coefficients?

A: H3. Update: In Version 5, these statistics are now stored in reserved variables for easy access, as described in the description of LINREG in the Reference Manual. The standard errors are stored in a VECTOR called %STDERRS, while the T-stats are stored in %TSTATS (early printings of the manual incorrectly identify the standard errors variable as %STDERRORS).

If you are using an older version of RATS, you can calculate these values fairly easily using other reserved variables. The examples below create a vector of standard errors, a vector of t-stats, and a vector of significance levels for the t-stats:

For least-squares regressions (e.g., LINREG, ESTIMATE), where %XX is equal to Inv(X'X):

LINREG depvar # list of regressors DECLARE VECTOR SE(%NREG) TSTAT(%NREG) SIGLEVEL(%NREG) EWISE SE(I) = SQRT(%SEESQ*%XX(I,I)) EWISE TSTAT(I) = %BETA(I)/(SE(I)) DO I=1,%NREG CDF TTEST TSTAT(I) %NDF COMPUTE SIGLEVEL(I) = %SIGNIF END DO I WRITE SE TSTAT SIGLEVEL For other estimations, (e.g., SUR, LINREG with ROBUSTERRORS), the %XX matrix is the estimated covariance matrix, so you omit the %SEESQ term from the SE formula. For SUR, NLSYSTEM, MAXIMIZE, LGT, PRBIT, or any estimation with ROBUSTERRORS, the t-statistic is treated as a normal distribution, so use NORMAL on the CDF instruction (see Appendix F for details on t-statistic significance levels):

LINREG(ROBUSTERRORS) depvar # list of regressors DECLARE VECTOR SE(%NREG) TSTAT(%NREG) SIGLEVEL(%NREG) EWISE SE(I) = SQRT(%XX(I,I)) EWISE TSTAT(I) = %BETA(I)/(SE(I)) DO I=1,%NREG CDF NORMAL TSTAT(I) %NDF COMPUTE SIGLEVEL(I) = %SIGNIF END DO I WRITE SE TSTAT SIGLEVEL

Q: H4. Can I control the formatting (i.e. number of places after the decimal) of output displayed by PRINT or the regression instructions?

A: H4. Update: With Version 5, the PICTURE option was added to the PRINT command. It allows you to control the formatting of output. See the description of PRINT in the RATS 5 Reference Manual for details.

If you have Version 4 or older, there is no general setting that affects the number of decimals displayed by PRINT. If you want to print out (display) a set of series with a specific format, use the COPY instruction with the UNIT=OUTPUT (if you want the output directed to the screen) and FORTRAN format options.

For regression output, you can use the DISPLAY instruction with position and picture codes to display the contents of reserved variables defined by regression instructions (e.g., %SEESQ, %RSQUARED), or any other values you calculate.


Q: H5. Can RATS do unit-root tests and cointegration analysis?

A: H5. Yes. Although RATS doesn't have built-in instructions for these, all the necessary tools are there, and these tools have been put to use by Estima and others to write procedures for unit-root and cointegration analysis.

The RATS package includes procedures for doing Dickey-Fuller and Phillips-Perron unit root tests (on the files DFUNIT.SRC and PPUNIT.SRC, respectively), which are documented in the RATS User's Manual. Various RATS users have written other unit-root procedures, many of which are available for downloading from this web site (see List of Procedures and Examples).

For cointegration analysis, check out the CATS in RATS program. This is a sophisticated set of procedures written by Johansen, Juselius, and Hansen. It includes an extensive manual providing an overview of cointegration theory and details on using the CATS procedures.


Q: H6. Can RATS solve linear/quadratic programming problems?

A: H6. Yes! Beginning with Version 4.30, RATS now includes a built-in instruction for solving linear and quadratic programming problems. If you have an older version of RATS, you can use the procedures contained in the LPQPPROC.SRC file to solve these problems. This file was included with RATS Version 4.10 and later. If you have version 4.0x, you can download the file from this web site (see the List of Procedures and Examples)/. The Procs page also includes a couple of example programs. For instructions on using the procedures, view the LPQPPROC.SRC file, or see the January, 1994 issue of the RATSletter.


Q: P1. What does the message "## SR12. We recommend File-Clear Program or END xxx before ALLOCATE" mean?

A: P1. You get this message if you've already execute an ALLOCATE instruction, and try to execute an ALLOCATE again without first clearing the program memory. This usually happens when you are running in interactive mode, and try to re-run an entire program from the beginning.

With RATS versions 4.00 and later, you must clear the program memory before you can re-execute an ALLOCATE instruction. In interactive mode, you can do that by selecting the "Clear Program" operation from the "File" menu before re-running your program (this clears from memory all series and other variables, CAL and ALL etc.). You can also clear the memory by issuing an END instruction with some text serving as a "continue signal" (see the description of END in the RATS manual for details).

Note that one of the advantages of interactive mode is that you don't necessarily need to re-execute your entire program if you only need to make minor modifications. For example, if you want to try a different regression model, you only need to re-execute the regression instruction itself--you don't have to go back and re-set CAL and ALL, re-read your data file, and so on.

In versions of RATS prior to 4.00, re-executing an ALLOCATE instruction simply re-set the default series length and cleared all existing series from memory. However, because the series length specified by ALLOCATE is no longer a binding limit, ALLOCATE no longer has this effect. If you do re-execute ALLOCATE without clearing the memory, RATS will continue to process instructions, but it won't be able to keep track of series properly.


Q: P2. What do I do if I get the memory request error, such as "## M4. A memory request for an additional 64012 bytes cannot be satisfied"?

A: P2. This message means that the RATS instruction you tried to execute would require more memory than is currently available to RATS. This error and related memory issues are discussed extensively in the Getting Started manual (called the Installation and Use Guide prior to version 4.2), so we refer you there for detailed information.

A couple of quick suggestions might be helpful, however:

1. PC RATS (the basic DOS version) can only make use of conventional memory, so it is quite limited in capacity. In most situations, you will be limited to a maximum of about 15,000 data points with PC RATS. Consider upgrading to RATS386 or WinRATS.

2. If you have RATS386, make sure you are typing "RATS386" to start the program, not "RATS" (which starts PC RATS).

3. If RATS is requesting a very large amount of memory, check for mistakes in the instruction in question. If the instruction deals with data series, check for mistakes on your ALLOCATE instruction (for example, if you allocation is set incorrectly, you may be creating much larger series than intended).

Again, please see the Getting Started manual if you need more information.


Q: P3. I can't seem to execute instructions, or "Help, I'm in 'Local' mode and I can't get out!"

A: P3. In order to execute instructions from a particular window, that window must be designated as the "input window." Also, (DOS and Windows versions only) you must be in "Ready" mode, as opposed to "Local" mode. If hitting <Enter> inserts a carriage-return rather than executing an instruction, you are either in "local" mode, or the window you are working in is not designated as the "input window" (or both).

The "Use for Input" operation on the Window menu designates the current window as the input window. Use <Ctrl>+L or the "Ready/Local" toolbar icon to switch between ready and local modes.

Please see the Getting Started manual (Install and Interface Guide for versions prior to 4.20) for details on executing instructions.


Q: P4. I tried to run one of the RATS procedures (e.g. DFUNIT or BJFORE), and got the following error: ## CP18. DFUNIT is not the Name of a PROCEDURE. (Did you forget to SOURCE?)

A: P4. Before you can execute a procedure, RATS has to "compile" the instructions that make up the procedure. If these are stored on a separate file, you should use the SOURCE instruction to read the procedure instructions from the desired file before you try to execute it.

For example, if you want to run the DFUNIT procedure included with RATS (for doing a Dickey-Fuller unit root test), you should include an instruction like:

SOURCE C:\RATS\DFUNIT.SRC in your program. After the SOURCE, you can execute the procedure with an instruction like:

@DFUNIT(TREND,LAGS=2) X


Q: P5. I'm having trouble using the regression lists created with the ENTER instruction, particular when I use lags in the regression list. What's going on?

A: P5. The most likely explanation is that ENTER and regressor lists don't work they way you think they do. ENTER is primarily designed to get and save regression lists for use in subsequent regressions (as in a procedure). It is not well suited to getting lists of variables which you can access individually.

When you use ENTER with a regression list, the resulting array does not contain the actual values of the series on the list. Instead, the array will contain integer numbers representing each piece of information supplied on the list (that is, each series number, lag number, and any special characters such as {, }, or the word "TO"). For example, suppose you do the following:

DECLARE VECTOR[INTEGER] REGLIST
ENTER(VARYING) REGLIST
# X1 X2{1 TO 4}
Further, suppose that X1 and X2 are series numbers 1 and 2 (each series in memory has an integer number associated with it, usually based on the order in which it was created). If you use WRITE to display the contents of REGLIST, you get:
  1    2    -32763    1    -32766    4    -32764 

As you can see, large negative integers are used to code the {, }, and "TO" symbols. As a result, doing something like:

SET S = ([SERIES]REGLIST(1)){1}

isn't very reliable if the regressor list includes lag notation. If you do want to use ENTER for such purposes (i.e. transforming some or all of the variables in the list, etc.), there are a few things you can do. For example:


Q: P6. I can't read DBF format data files created in the Year 2000. Is this a Year 2000 Bug?

A: P6. This is not a Year 2000 bug in RATS. Rather, it is a problem with the DBF file format itself. Normal date fields in DBF files are Year2 2000-compliant, and work fine with RATS. However, DBF files also include a record near the beginning of the file that is used to store the date on which the file was last modified. Unfortunately, this record only allows space for storing two (hex) numbers--not enough to store a 4-digit year.

Because DBF files contain very little in the way of information to identify their format, RATS is currently set up to look for a valid date in this field as a way of determining whether or not a file is in fact a DBF database. dBase, the standard for DBF files, sets this field to the value 100 for the year 2000, 101 for year 2001, and so on. So, we designed RATS to look for any year greater than zero in this field.

Unfortunately, Microsoft's FoxPro sets this field to zero, rather than 100 (see Microsoft's Year 2000 web pages for more information on this). If you open such a file in dBase, it will tell you that the file was last modified in 1900. Current versions of RATS (i.e. through RATS 4.31) will reject the file as not having a valid DBF format. Future versions of RATS will ignore the date field. This hinders its ability to reject a non-DBF format file if you specify FORMAT=DBF on a DATA instruction, but will allow it to read FoxPro files created in the year 2000 and beyond.

In the meantime, the alternatives for FoxPro users would be to either open and close the file in dBase, or else export the data to another format (spreadsheet, PRN or FREE format text, etc.).


Q: M1. Is RATS "Year 2000" compliant?

A: M1. Yes, RATS is Year 2000 compliant--it can correctly handle dates into and beyond the year 2000 (and prior to 1900 as well). However, you need to make sure that you use 4-digit year references when working with data that crosses century boundaries. For detailed information, including suggestions on converting data files to 4-digit format, see What About the Year 2000, which appeared in our February 1997 RATSLetter.


| Home Page | RATS | All Products | Procs | Support | Search |

Copyright © 2006 Estima. All Rights Reserved.
This file was last modified on 01/19/24