The Code and Data Library:
Your guide to a variety of programming tools.
Output Gaps:
Contains a large RATS data file storing rolling estimates of US output
gaps constructed using real-time data and various detrending methods.
Also contains the programs and raw data used to construct the output
gaps.
Back
to the top
Switch:
This is the most up-to-date version of the switching regression
procedures built by myself and Robert Vigfusson with help from Jeff
Gable. If you're not familiar with them, they let you estimate a
general class of regime-switching models along the lines of those
described in James Hamilton's textbook. Key
features and limitations of the code include:
- one independent variable only
- two states only
- arbitrary number of observed variables may be included to
explain
time-varying transition probablities or state-dependent means
- external c-code, analytical gradients and combined maxlik()/EM
algorithms for fast calculation
- descriptive statistics, plots and White's model-misspecification
tests
- cascading estimation
- separate, faster code for "simple switching" models (i.i.d.
mixtures
of regimes.)
The original version was documented as Bank of Canada Working
Paper 96-3 and is still available from the Bank's web
site. The latest
version available here accompanies the paper "Avoiding the Pitfalls..."
by
van Norden and Vigfusson (SNDE 1998.) Differences in the latest version
include:
- updated from GAUSS 3.x to GAUSS 4.x and the corresponding
updates in
maxlik()
- includes a library file for references to all procedures (no
more
"#include"!)
- improved external C-code Markov switching models drastically
cuts
execution times
- use of the Kim's algorithm for faster calculation of smoothed
probabilties in Markov models
No, we still haven't done the EM algorithm for Markov models with
non-constant transition probabilities.
Back
to the top
UnitRoot:
A slew of RATS procedures programmed by myself and Robert Amano at the
Bank
of Canada in the early 1990s as the Hendry general-to-specific
methodology and new cointegration tests started to work their way into
the mainstream. Originally programmed in RATS 3.0, then ported to
4.0. I haven't looked
at this stuff in years; it has been duplicated very nicely by
commercial packages
(I like COINT for GAUSS by Ouliaris & Phillips for most of my
unit-root
and cointegration needs.)
Key features include
- UNITROOT.SRC, which performs a battery of unit-root tests and
prints
results in a comparative table
- MCKINNON.SRC gives accurate finite-sample critical values for
the
above
- RESDIAG.SRC, which performas a battery of residual diagnostic
tests
- Rolling breakpoint tests and rolling parameter estimates, both
with
efficient coding for fast execution
A GAUSS procedure that HP-filters*
data.
Coding this efficiently requires the banded matrix functions that were
added
to GAUSS in the last few years. For those who have older versions
of
GAUSS, a slower but more widely-compatable version of the proc is also
included.
Back
to the top
Graphics:
A collection of handy things for GAUSS's clean, versatile and
user-hostile PQG graphics.
- If you do Monte Carlo or Bootstrap or Randomization experiments,
check out pvalplot() and the referenced article by
Davidson and MacKinnon.
- bihist() does a 3-D histogram, showing the joint
density of two random variables
- shadebox() lets you draw shaded rectangular
regions
on graphs using plot co-ordinates.
Back
to the top
Usage:
All these procedures are protected by copyright. You are free to use
these
procedures as you like, but I ask that you acknowledge their use in any
published
work. You may distribute them provided that you do not alter them in
any
way and that no fee of any kind is charged for them and they are not
included
as part of any commercial product.
Back
to the top
Bugs:
I and many colleagues have used these procedures, but there is no
guarantee as to their accuracy or reliablity. They are free and
you get at least
as much as what you pay for. I do try to keep track of known bugs
and
may try to fix them. Feel free to report bugs; concise and simple code
illustrating
the bug is more likely to be acted upon. Some of these procs may
be
for older versions of the software - please do not mail me asking for
updated
versions. In most cases, there are now updated alternatives available
from
other sources.
Back
to the top
Links:
I will include some links to other useful depositories of econometric
computer code. If you would like me to include a link to your code
library, please drop me a line.
Back
to the top
Acknowledgements:
I've contributed substantially to all of these, but many depended on
collaboration with others. I've tried to note authorship on all the
procs, but special thanks
go out to Robert Amano and Robert Vigfusson.
Back
to the top
*Why
anyone would want to use the HP filter is another question
entirely, but don't get me started! My providing the procedure
does not constitute an endorsement of this methodology. Yes, I
know that it is not properly attributed to Hodrick and Prescott and
that the method dates back to the stats literature of the 1920s.