Vassilis Hajivassiliou                              February 1992
(aided by Yoosoon Chang)                            June 1995

FORTRAN implementation of 13 simulation algorithms given in
Hajivassiliou, McFadden, and Ruud, "Simulation of Multivariate
Rectangle Probabilities and their Derivatives: Methods and Programs,"
Cowles Foundation Mimeo, November 1994, forthcoming in the Journal of
Econometrics. 

6 files constitute the main program:
-----------------------------------
1. har_main.f
   A harness program to set up monte carlo test runs.
2. har_libd.f
   Machine-Dependent routines, necessary for timing the results.
   Three versions are given, one for SunOS/UNIX (har_libd.sun), 
   one for PC/Lahey fortran (har_libd.lh), and one with dummy routines
   that should compile on any machine (har_libd.dum).
3. har_libm.f
   Matrix operation routines.
4. har_libo.f
   Other utility routines.
5. har_libs.f
   The basic Simulation routines, following the GAUSS implementation
   in terms of calling arguments, etc.
6. har_libt.c  (required for UNIX)
   This is a C routine that interfaces with the system clock, which
   is necessary for the timings.

A 7th file is required, defining the maximum dimensions:
-----------------------------------------------------------
7. hdim.inc
   Before compiling, you must change this dimensioning file for the
   maximum number of elements in the multivariate normal (mmaxim), and
   for the maximum number of simulations allowed (irmaxim). 

NB:  The program will search automatically for the environment variable
--   'machine' and will make a note in the output of the computer used.
     (On UNIX, the environment variable 'machine' must be lower case -- 
     on DOS, the case is not relevant.)

For users on a UNIX system:
--------------------------
To prepare the executable files "harness" and "asd2asc", run the
script file "har_make" by issuing the command "source har_make".
You may have to modify the fortran compilation lines for your system
-- on the Sun, the highest level of optimization is -O4.

Results of a Run
----------------
The results will be placed in files xxMMMM.asd, where xx=a two-letter 
name specified by the user at run time, and MMMM is the 3 or 4 letter
identifier for the simulation algorithm (e.g., CFS, ARSE, etc.).
The *.asd files are "direct-access" files, which are not easily
readable.  To change them into usual ASCII files, run the program
"asd2asc".  Each *.asc file contains the "true" (usually quadrature)
values for the quantities to be simulated, and the results of each 
Monte Carlo repetition on a new line.

For GAUSS users:
---------------
The program will create automatically the file 'xxmkgau.bat', where 
xx is the two-letter name specified by the user at run time.  When
run on a DOS machine with the GAUSS utility ATOG on the path, this
batch file will automatically translate the *.asc result files
created as described above to GAUSS .DAT/.DHT data sets.  This will
facilitate the analysis of the Monte Carlo results of a particular
run using GAUSS.
