This companion file describes the programs used in Charles Bos, Ronald
Mahieu and Herman van Dijk, "Daily Exchange Rate Behaviour and Hedging of
Currency Risk", Journal of Applied Econometrics, Vol. 15, No. 6, 2000, pp.
Declaration files
-----------------
In the course of the paper, a range of programs have been used. Some
programs are specifically targetted at computations concerning a
specific model. If so, the programs loads the settings from a set of
declaration files. These files are
simox.dec - Model settings, including indication of name, dataset,
routines with posterior density function etc.
prior.dec - Settings on the prior density of the parameters
mhsamp.dec - Settings controlling the length of the Metropolis-Hastings
chain
gibsamp.dec - Settings controlling the length of the Gibbs chain
A range of declaration files can be found in the directory
bmvd_jae/decl/. They contain settings for
madu.dec - The white noise (WN) model
mbdu.dec - The local level (LL) model
mcdu.dec - The generalized local level (GLL) model
mddu.dec - The generalized local level-GARCH (GLL-GARCH) model
medu.dec - The generalized local level-Stochastic Volatility (GLL-SV) model
mfdu.dec - The generalized local level-Student t (GLL-St) model
mgdu.dec - The generalized local level-GARCH-Student t (GLL-GARCH-St) model
Copy one of these files over bmvd_jae/simox.dec to change the model.
The length of the sample can be controlled changing parameters in
mhsamp.dec or gibsamp.dec. It is also possible to copy
bmvd_jae/decl/sample/XXshort.dec or bmvd_jae/decl/sample/XXlong.dec
over bmvd_jae/XXsamp.dec, to change to a `short' or `long' sample. The
long sample is the one used in the article, but a Gibbs sampler may well
take a day to calculate on a 400 Mhz Sun Sparc system. Also the
computation of the marginal likelihood using output from the Gibbs
sampler is very time consuming: For the models containing GARCH
components, timing may reach 27 hours.
The priors are fixed to the priors used in the article.
Program files
-------------
The programs are all written in Ox, and make use of a dynamic link library
which is available for the Linux, Sun Solaris and Windows operating systems.
On other systems, the C code is replaced by (slower) Ox code.
Apart from Ox, the graphing package GnuDraw (see
http://www2.tinbergen.nl/~cbos/gnudraw.html) has to be installed,
together with GnuPlot (http://www.gnuplot.org).
The following programs are available in the bmvd_jae-directory:
plotdaty.ox - Plot graphs concerning the dataset, as in figures 2 and
3 in the paper.
mhflex6.ox - Sample from a posterior density, using a Metropolis-
Hastings algorithm. Valid for the WN, LL, GLL and
GLL-GARCH models
gibgas20.ox - Sample from a posterior density, using Gibbs sampling,
and calculate the one-step ahead predictive density.
Valid for the LL, GLL, GLL-GARCH, GLL-Student t and GLL-
GARCH-Student t models. A picture similar to figure 6 is
drawn.
gibsv20.ox - Sample from the posterior density of the GLL-SV model, and
calculate the one-step ahead predictive density. This
program creates figure 6 of the paper.
calcdre4.ox - Calculate the one-step ahead predictive density. Valid
(and needed) only for the models on which the MH sampler
was run. A picture similar to figure 6 is drawn.
mixpltub.ox - Plot the posterior density for one model (as indicated by
simox.dec).
postana6.ox - Analyze and plot the posterior density, together with the
priors and the 95% HPD region, for all models. Results in
output from which tables 2 and 3 and figures 4 and 5 of
the paper were constructed.
mlwn.ox - Calculate the marginal likelihood using output from the
Gibbs sampler, for the WN model.
mlgas6.ox - Calculate the marginal likelihood using output from the
Gibbs sampler, for the LL, GLL, GLL-GARCH, GLL-Student t
and GLL-GARCH-Student t models.
mlgsv3.ox - Calculate the marginal likelihood using output from the
Gibbs sampler, for the GLL-SV model. Output of mlwn,
mlgas6 and mlgs3 is combined into table 4.
mlkern.ox - Calculate the marginal likelihood using a LaPlace,
harmonic mean or kernel approximation. Only valid for
models on which the MH sampler could be used.
hedrat7.ox - Use the predictive densities of all models to calculate
the hedge ratios. Outputs loads of tables for values of
gamma between -20 and 0.5. Among these, the information of
tables 5, 6 and 7 can be found. It also plots the relation
between gamma and the final return, utility, maximum
3-month loss and 3-month gain. Figures similar to figures
7 and 8 also are created using this program.
foreris2.ox - Evaluate the forecasting capabilities of the models,
resulting in table 8, in the output under the heading
`Single sided coverage test'.
numacc3.ox - Check the relative numerical efficiency, by comparing the
usual covariance matrix to a correlation consistent estimate
of the covariance matrix.
Output from the programs
------------------------
Model-specific output from the programs is written to a file in the
directory bmvd_jae/excl/mXdu/, with X a letter (a-g) indicating the
model. Not model-specific output can be found in bmvd_jae/excl/, or,
concerning the program hedrat7.ox, in excl/hedret. Output may come in a
file with the extension .out (indicating a pure text file), or in a file
.plb. This latter extension indicates a graphic file, to
be shown on the screen using the (GnuDraw) command
plb2scr
or translated to eps using
plb2eps
This only works if both GnuPlot (http://www.gnuplot.org) and GnuDraw
(http://www2.tinbergen.nl/~cbos/gnudraw.html) are installed correctly.
Furthermore, intermediate results are saved in matrix files with the
extension .fmt or .mat.
Order of execution
------------------
Most programs depend on output from other programs; e.g. the sampling
has of course to be done before the predictive density can be
calculated. In the script-file compall, or batch file compall.bat, the
commands are given to run all calculations consecutively. Note that a
complete run may take quite some time, e.g. around 7 hours on a Sun Sparc
400Mhz machine, for the `short' sample.
Charles Bos, 16/11/2000
cbos@few.eur.nl
http://www2.tinbergen.nl/~cbos/