RATS 10.1
RATS 10.1

<Root level>

Procedures

Home Page

← Previous Next →

Many of the capabilities of RATS are made available through the use of procedures. Procedures are text files of RATS instructions which function much like a built-in instruction, but with greater flexibility. Consider, for instance, a Dickey-Fuller test. This is just a simple linear regression with a specific set of variables. A augmented Dickey-Fuller test with lags chosen by some means requires a set of linear regressions. There is no great advantage to having this "hard-coded" into a RATS instruction (like LINREG itself) since the calculation is quite straightforward. The advantage of providing the D-F test through a procedure is that it's easy to modify either by you, or by us.


The RATS distribution includes over 300 procedures, with more created all the time. Because procedures are so important to the use of RATS, it's important for the program to be able to find the most current versions. RATS maintains a set of search directories. This is generally set up properly when you first install the program, but you can change the directory, or add additional ones for your own procedures.

 

If you execute a procedure with (say)

 

@dfunit lgdp

 

RATS will automatically search for a file whose name matches that of the procedure, with a .SRC extension, so in this case dfunit.src. The search path(s) are set in the program's preferences in the Procedures Directories field on the Directories tab. If you have more than one directory listed, it will start with the first, then, if it's not found, move to the next. By putting your own directory above the standard one, you can use an altered copy before the distribution one.

 

Executing a Procedure

The basic syntax for executing a procedure is:

 

@procedure_name( options )    parameters

< supplementary cards > (if needed)

 

Everything is the same as a standard RATS instruction except two things:

The procedure name is preceded by @.

You can’t abbreviate the procedure name.

 

The following uses the procedure @DFUNIT (Dickey–Fuller Unit root test) to do unit root tests on the series TBILL using several sets of options:

 

@dfunit(det=constant) tbill

@dfunit(det=constant,maxlags=6,method=gtos) tbill

@dfunit(det=constant,maxlags=6,method=aic) tbill

 

Loading the Procedure

To use a procedure or function stored on a separate file, you need to have RATS execute the instructions that define the procedure. In most cases, RATS can do this automatically, by searching for a file with a .src extension whose name matches the name of the procedure. Otherwise, you can compile procedures stored on a file using the SOURCE instruction:

 

source   name of file with PROCEDURE or FUNCTION

 

If RATS can’t load a procedure:

Check to make sure you did a full installation, including all of the files supplied with RATS. "Installing RATS" for details.

Check the “Procedure Directory” setting on the “Directories” tab in the preferences. In order for RATS to find procedure files automatically, this should point to the directory containing your procedures. See "Where to Find It" for Windows or Macintosh.

If you know where the procedure file is installed on your computer, include a SOURCE instruction (with a complete path and filename) prior to the procedure call to source in the procedure.

You may be running an out-of-date version of RATS that did not include the procedure in question. If you do Help—Update Procedures..., RATS will list all procedures that have been added or changed since your version was released and that can be used on what you are running. You can do Help—About RATS to check which version you are using. See "Updates" or email sales@estima.com for information on updating. If you are using a network license at a company or university, your institution may already have the most recent version available—check with your system support staff.

If all else fails, you should be able to download the procedure using the “Procedure Browser” on the “Resources” section of our website.

 


 

Procedure Listing

 

The most important of the procedures are listed in this section alphabetically with (for most) links to a description of their use. For other procedures (or even for the ones shown here), you can open the .SRC file and read the comments to see how they work.
 

@ABLAGS

Generates Arellano-Bond set of instruments

@ACF

Performs autocorrelation analysis on a series

@ACF2PACF

Computes autocorrelations from partial autocorrelations

@ADFAUTOSELECT

Selects optimal lag length to be used for an ADF test

@ADTEST

Anderson-Darling test for normality

@AGFRACTD

Andrews-Guggenberger estimate of fractional difference

@APBREAKTEST

Andrews-Ploberger Structural Break Test

@APGRADIENTTEST

Andrews-Ploberger Structural Break Test for GARCH/Maximum Likelihood

@ARAUTOLAGS

Computes Information Criteria for AR models using Yule-Walker or Burg

@ARCHTEST

Tests a series for ARCH effects

@ARMADLM

Sets up a DLM based upon an ARMA model

@ARMASPECTRUM

Graphs the spectral density for an input ARMA model

@BAING

Estimates factors in a factor model using Bai-Ng formulas

@BAIPERRON

Bai-Perron Test for Multiple Structural Changes

@BAYESTST

Bayesian Unit Root test

@BDINDTESTS

Battery of independence tests

@BDSTEST

Brock-Decher-Scheinkman test for i.i.d.

%BETAPARMS

Computes parameters required for beta distribution

@BICORRTEST

Hinich bi-correlations test for autocorrelation

@BJAUTOFIT

Automated ARIMA model selection

@BJDIFF

Aids in selection of differencing operations

@BJEST

Estimates an ARIMA model

@BJFORE

Estimates and forecasts an ARIMA model

@BJIDENT

Box-Jenkins identification tool

@BJTHEIL

Computes Theil U statistics for an ARIMA model

@BJTRANS

Aids in selection of preliminary transformation

@BKFILTER

Band pass filter using Baxter-King method

@BNDECOMP

Beveridge-Nelson decomposition

@BPPANELTESTS

Does Breusch-Pagan (and related) tests for random effects

@BQDODRAWS

Does Monte Carlo draws from a VAR with BQ factorization

@BREITUNG

Breitung test for unit roots in panel data

@BRYBOSCHAN

Bry-Boschan business cycle dating (Pagan-Harding for quarterly data)

@BSOPTION

Black-Scholes option pricing procedure

@BVARBUILDPRIOR

Builds up a prior for a linear equation one element at a time.

@BVARBUILDPRIORMN

Builds up a prior for a Bayesian VAR

@CANCORR

Computes canonical correlations for two sets of series

@CFEAT

Identifying turning points and cyclical phases of a series

@CFFILTER

Band pass filter using Christiano-Fitzgerald method

@CHOWDENNING

Chow-Denning multiple variance ratio test

@CHOWLIN

Distributes a series to a higher frequency using related series (obsolete: use @DISAGGREGATE instead)

@CLASSICALDECOMP

Decomposes a series into trend, seasonal, irregular

@CONDITION

Conditional forecasting procedure

@CORRADO

Corrado non-parametric event test

@CORRINTEGRAL

Computes a correlation integral for a series

@CROSSCORR

Computes and graphs cross correlations of two series

@CROSSPEC

Computes and graphs phase and coherence

@CSERIESSYMM

Complex series symmetrizer

@CUMPDGM

Durbin’s Cumulated Periodogram for serial correlation

@CUSUMTESTS

Computes and displays CUSUM and CUSUMQ tests

@CVSTABTEST

Stability tests on a covariance matrix of series

@CXLOGDENSITY

Computes Whittle likelihood using complex matrices

@CXLOGDENSITYCV

Computes concentrated multivariate Whittle likelihood using complex matrices

@DENTON

Distributes a series to a higher frequency using proportional Denton method (obsolete: use @DISAGGREGATE instead)

@DFUNIT

Dickey-Fuller unit root test

@DISAGGREGATE

General disaggregation (interpolation/distribution) procedure

@DISTRIB

Distribution from one frequency to a higher frequency

@DIVISIA

Computes a Divisia index

@DLMIRF

Impulse Reponse Function from a State-Space model

@DMARIANO

Diebold-Mariano Forecast Comparison Test

@DURBINLEVINSON

Computes Autoregressive Representations using Durbin-Levinson recursion

@EBA

Extreme Bounds Analysis, from Granger and Uhlig

@EGCRTVAL

Computes "exact" critical values for Dickey-Fuller unit root and Engle-Granger cointegration tests.

@EGTEST

Engle-Granger test for Cointegration

@EGTESTRESIDS

Engle-Granger test for Cointegration on 1st stage residuals

@ELFCALC

Computes empirical likelihood for a set of moment conditions

@ENDERSGRANGER

Enders/Granger threshold unit root tests

@ENDERSSIKLOS

Enders-Siklos test for cointegration with threshold effect

@EQNTOACF

Creates an ACF from an ARMA equation

@ERSTEST

Elliott-Rothenberg-Stock unit root tests

@EXACTINVERSE

Computes exact (limit) inverse with “infinite” components

@FLUX

General Nyblom fluctuations test

@FM

Estimates cointegrating vectors using Fully Modified Least Squares

@FORCEDFACTOR

Factors covariance matrix with specific vector column/row

@GAIN

Computes and graphs the gain and phase of a pair of series

%GAMMAPARMS

Computes parameters required for gamma distribution

@GARCHFORE

Univariate GARCH forecasting procedure

@GAUSSHERMITE

Generates weights and grid points for Gauss-Hermite numerical integration

@GEDDRAW

Generates draws for a generalized error distribution

@GENCOMBOS

Generate all combinations of a set of integers

@GLSDETREND

Local to unity GLS detrending routine

@GMAUTOFIT

Automated ARIMA model selection (seasonal models)

@GNEWBOLD

Granger-Newbold forecast comparison test

@GPH

Geweke-Porter-Hudak estimate of fractional differencing

@GRAPHMATRIX

Graphs a RECTANGULAR array of series on separate graphs

@GREGORYHANSEN

Gregory-Hansen test for cointegration with breaks

@GRIDSERIES

Generates a series with an equally spaced grid

@HADRI

Hadri test for unit roots in panel data

@HALTON

Generates Halton sequences

@HANNANRISSANEN

Estimates an ARIMA model using the Hannan-Rissanen algorithm

@HEGY

Performs a HEGY seasonal unit root test for quarterly data

@HILLGEV

Estimates tail index for a distribution using Hill’s method

@HINICHTEST

Hinich bispectrum test for linearity and Gaussianity

@HISTOGRAM

Histogram procedure

@HJBOUNDS

Computes Hansen-Jagannathan bounds for a set of returns

@HPFILTER

Hodrick-Prescott filter (obsolete)

@HTUNIT

Harris-Tzavalis unit root test for panel data

@HURST

Computes a Hurst exponent

@ICSS

Inclan-Tiao test for breaks in variance

@IMHOF

Computes CDF for quadratic form in Normal(0,1) variables. Obsolete—use functions %QFORMPDF or %QFORMDPDF functions.

@IMPACTSIGNFLIP

Corrects signs of columns in a factor matrix

@INTERPOL

Interpolation from one frequency to a higher one

%INVCHISQRPARMS

Computes parameters required for inverse chi-squared distribution

%INVGAMMAPARMS

Computes parameters required for inverse gamma distribution

@IPSHIN

Im, Pesaran and Shin panel unit root test

@IRFRESTRICT

Used to build up a set of zero-valued restrictions for impulse responses impact and higher steps

@JOHMLE

Johansen ML Cointegration analysis

@KPSS

KPSS (Kwiatowski, Phillips, Schmidt, and Shin) stationarity test

@KSCPOSTDRAW

Draws from posterior density needed in stochastic volatility model

@LAGPOLYROOTS

Creates table of the roots of a lag polynomial

@LEVINLIN

Levin-Lin-Chu test for unit roots in panel data

@LIML

Limited information maximum likelihood estimation

@LOCALDLM

Creates matrices for local (level or trend) DLM

@LOCALDLMINIT

Calculates initial guesses for component variances in a local level/trend

@LOCALTREND

Local smoothing regression

@LOGMVSKEWT

Function for log density of multivariate skew-t distribution

%LOGNORMALPARMS

Computes parameters required for log normal distribution

%LOGSKEWGEDDENSITY

Function for log density of skew-GED distribution

%LOGSKEWGEDGARCH

Function for log density of skew-GED distribution for use with GARCH with DENSITY option.

%LOGSKEWTDENSITY

Function for log density of skew-t distribution

%LOGSKEWTGARCH

Function for log density of skew-t distribution for use with GARCH with DENSITY option.

@LPUNIT

Lumsdaine-Papell unit root test with structural breaks

@LSDVC

Estimates a dynamic FE model with correction for bias

@LSUNIT

Lee-Strazicich unit root tests with one or more structural breaks

@MAAUTOLAGS

Computes Information Criteria for MA models using innovations algorithm

@MACKINNONCV

Computes Mackinnon’s Critical values for DF and EG tests

@MANNWHITNEY

Performs Mann-Whitney test for comparison of samples

@MARKOV

Functions supporting Markov Chain Models (obsolete use @MSSETUP instead)

@MATPEEK

Extracting/inserting information from/into rectangular arrays (obsolete: use %XSUBMAT and %PSUBMAT functions instead)

@MCFEVDTABLE

Organizes tables of FEVD’s with confidence bands

@MCGRAPHIRF

Organizes graphs of IRF’s with confidence bands

@MCLEODLI

Performs a McLeod-Li test for 2nd order dependence

@MCMCPOSTPROC

Calculates sample statistics from MCMC realizations

@MCPROCESSIRF

Organizes error bands for IRF’s based upon MC results

@MCVARDODRAWS

Does Monte Carlo draws from a VAR to generate IRF’s

@MEANGROUP

Mean group estimator for panel data

@MEPLOT

Does Mean Excess Return plots

@MESA

Computes and graphs a spectrum using Maximum Entropy Method

@MHEGY

Implements the monthly version of the “HEGY” tests

@MIXED

Mixed estimation of a single equation

@MIXVAR

Mixed estimation of an equation with a Bayesian prior

@MONTEVAR

Monte Carlo Integration of VAR Impulse Response confidence bands

@MSEMSETUPSTD

Markov switching procedures for EM estimation

@MSREGRESSION

Markov switching linear regression procedures

@MSSETUP

Markov switching general support procedures

@MSSYSREGRESSION

Markov switching linear systems regression procedures

@MSVARSETUP

Markov switching VAR setup procedures

@MULTIPLEBREAKS

Multiple structural change analysis per Bai-Perron

@MVARCHTEST

Multivariate test for ARCH

@MVBNDECOMP

Multivariate Beveridge-Nelson decomposition via a VAR

@MVGARCHFORE

Multivariate GARCH forecasting

@MVGARCHTOVECH

Extracts a VECH representation from GARCH estimates

@MVIDENT

Creates a Tiao-Box cross correlation matrix

@MVJB

Multivariate Jarque-Bera normality test

@MVQSTAT

Hosking’s Multivariate Q statistic

@NBERCYCLES

Generates dummies based upon NBER cycle dates

@OLSHODRICK

Computes Hodrick standard errors

@PACF2AR

Generates coefficients for an AR from input covariances

@PANCOINT

Panel data unit root/cointegration testing procedure (Pedroni tests)

@PANELDOLS

Panel data group mean DOLS

@PANELFM

Panel data group mean FMOLS

@PANELTHRESH

Does analysis of up to two threshold breaks in a fixed effects panel model

@PDL

Polynomial Distributed Lags regression

@PDLREG

Polynomial Distributed Lags regression

@PERRONBREAKS

Compute various unit root tests with breaks

@PERRONNGMTESTS

Compute various Perron-Ng “M” unit root tests

@PERRONRODRIGUEZ

Perron-Rodriguez unit root test allowing for break at unknown date

@PERSIST

Sum of coefficients of a MA representation for a series

@PHILLIPSHANNAN

Phillips-Hannan Efficient estimator for multivariate regressions

@POLYMULT

Multiplies lag polynomial coefficients. Obsolete: use %POLYMULT function instead.

@POTEST

Phillips-Ouliaris-Hansen test for Cointegration

@POTESTRESIDS

Phillips-Ouliaris-Hansen test for Cointegration on 1st stage residuals

@PPUNIT

Phillips-Perron Unit Root test

@PRINCOMP

Extracts principal components

@PRINFACTORS

Principal components-based factor analysis

@PRJCONDITIONAL

Predicted probabilities for conditional logit model

@PRJMULTINOMIAL

Predicted probabilities for multinomial logit model

@PRJPOISSON

Predictions and marginal effects for Poisson count model

@QPLOT

Graphs a Q plot against a hypothesized distribution

@QUARTIMAX

Does factor rotation using quartimax criterion

%RANGRID

Random draw from a distribution approximated across grid of points

@RANMIXTURE

Random draws from a mixture of Normals

@RANNORMALTRUNC

Random draws from a truncated Normal (procedure). Obsolete: use %RANTRUNCATE function instead.

@REGACTFIT

Regression post-processing, fancy graph of actual/fitted/resids

@REGANOVA

Displays an analysis of variance table from most recent regression

@REGCONFIDENCE

Displays a table of confidence intervals from most recent regression

@REGCORRS

Computes and graphs autocorrelations from residuals

@REGCRITS

Computes information criteria for most recent regression

@REGEXACTDW

Computes the exact significance level for the Durbin-Watson

@REGHBREAK

Performs structural break test with bootstrapped p-values

@REGPARTCORR

Computes partial correlations between the regressors and dep var.

@REGPCSE

Panel-corrected standard error calculation

@REGRECURSIVE

Regression post-processing, computes recursive resids, does tests (largely obsolete—use RLS instruction instead).

@REGRESET

Performs Ramsey RESET test on regression

@REGTOTEX

Creates a TeX equation from the most recent regression

@REGTREE

Performs a CART (Classification and Regression Trees) analysis

@REGWHITENNTEST

Performs White neural network test on regression

@REGWHITETEST

Performs White heteroscedasticity test on regression

@REGWUTEST

Performs Wu (or Durbin-Wu-Hausman) specification test on regression

@RGSE

Semiparametric fractional differencing parameter estimation

@ROBUSTLMTEST

Robust LM test for orthogonality of residuals and input series

@ROLLREG

Computes rolling regressions for least squares

@RRGQTEST

Computes a Goldfeld-Quandt test on recursive residuals

@RSSTATISTIC

R/S Statistic (classical or Lo’s modified)

@RUNTEST

Computes a run test for a two-state series

@SEASONALDLM

Creates the matrices for the seasonal component of a DLM

@SHORTANDLONG

Factor covariance matrix with short and long run restrictions

@SPECFORE

Forecasting using spectral techniques

@SPECTRUM

Computes/graphs spectral density

@SPLOM

Produces an NxN matrix of SCATTER plots

@SPUNIT

Computes various “Schmidt-Phillips” tests (TAU) for a unit roots

@SSMSPECTRUM

Multivariate spectral density of a state space model

@STABTEST

Perfoms Hansen’s stability test for OLS

@STAMPDIAGS

Performs a standard battery of specification tests for a state space model

@STARTEST

Test for linearity vs. LSTAR or ESTAR

@STEPPROBIT

Backwards stepwise reduction of a probit model

@STOCKWAT

Stock-Watson and Dickey-Fuller Unit Root Tests

@STRUCTRESIDS

Computes structural residuals from standard residuals

@SURGIBBSSETUP

Sets up Gibbs sampler for SUR model

@SWAMY

Computes a GLS matrix weighted estimator for a panel data set

@SWDOLS

Estimates cointegrating vectors using dynamic OLS

@SWTRENDS

Tests cointegration rank using common trends analysis

@TAR

Estimates a threshold autoregression, tests for threshold effect

@THRESHTEST

Hansen’s Test for Threshold Break

@TLOOKUP

Provides a procedure for doing table lookups

@TSAYNLTEST

Tsay test for neglected non-linearities

@TSAYTEST

Tsay arranged regression test for threshold autoregression (TAR)

@TSECCTEST

Tse test for constant correlation in MV-GARCH model

@TVARSET

Time-varying VAR setup routine

@UFOREERRORS

Forecast errors for a univariate model

@UHLIGFUNCS

Computes criteria for Uhlig sign-restricted shocks

%UNIFORMPARMS

Computes required parameters for uniform distribution

@UNIQUEVALUES

Extracts unique values from a series

@VARBOOTSETUP

Sets up a parallel system for bootstrapping a VAR

@VARCALC

Does a direct calculation of a simple OLS VAR

@VARFPE

Minimum FPE representation for the equations in a VAR

@VARFROMDLM

Computes a state space representation to its implied VAR

@VARIMAX

Does factor rotation using varimax criterion

@VARIRF

Organizes graphs of Impulse responses for an estimated VAR

@VARIRFDELTA

Computes the covariance matrix of an IRF using the delta method

@VARLAGMD

Computes the sums of the VAR lag coefficients (obsolete, use %MODELLAGSUMS function)

@VARLAGSELECT

Selects lag length for a VAR model

@VARMADLM

Routines for analyzing a VARMA using DLM

@VARSPECTRUM

Multivariate spectral density of a Vector Autoregression

@VRATIO

Variance ratio random walk test procedure

@WESTCHOTEST

Heteroscedasticity-robust serial correlation test

@WHITTLETEST

Implements Whittle test for independence of state sequences

@YULELAGS

Computes Information Criteria for AR models using Yule-Walker (obsolete: use @ARAutoLags instead).

@YULEVAR

Estimates a VAR on stationary data using Yule-Walker Equations

@ZIVOT

Zivot-Andrews Unit Root Test


Copyright © 2024 Thomas A. Doan