3 Nov 2005: Rough structure of DISCRETE

(as of 12 dec the structure of files has changed a lot. Will update this soon...)

DISCRETE uses the GRBL2 libraries to provide user-interface procedures, math routines,
maximum likelihood routines, and other such goodies.

DISCRETE also uses several "model specific" files.

Thus,
   *   DISCRETE.PRG is the main program.
   *   It contains a number of #INCLUDE statements.
          -- Some of these #INCLUDE the "GRBL2"  procedure files
          -- Some of these #INCLUDE the "model specific" procedure files.

To compile DISCRETE, you have to inform GAUSS where to find these #INCLUDEd files.

You can use GRBL2_INI.PRG short program to do this. 
Obviously, you should run GRBL2_INI.PRG before running (or compiling)
DISCRETE. 

You will have to modify GRBL2_INI.PRG to tell it where to find the files -- it is pretty well documented.

On a more abstract level, DISCRETE's basic architecture is:

  * DISCRETE uses GRBL2 procedures to read a "command file" -- the command file is something the user writes
    that tells DISCRETE what data file to use, what variables to use, and what models to run.

  * Depending on the model, DISCRETE calls a procedure (actually, a subroutine) in one of the "model specific"
    files. These subroutines massage the data, set up necessary parameters, call the MAXLIKC 
    estimation procedure, and displays results.

  * The call to MAXLIKC specifies the name of a likelihood/gradient/hessian
    estimation procedure that is contained in DISCRETE.MLE.

  * MAXLIKC does the dirty work of hill-climbing; the estimation procedures just provide
    likelihood (or gradient or hessian) values; given a candidate coefficient vector
    (supplied by MAXLIKC) and global matrices of variables (set up in the "model specific" files).


Details on the #INCLUDED files:

 GRBL2 files:
	include grbl2_procs.inc   -- A variety of useful I/O procedures, character manipulation 
				     procedures, etc. See GRBL2_PROCS.TXT for the details.
	include grbl2_file.inc    -- Some procedures for showing directories and displaying text files
	include grbl2_math.inc    -- A few math procedures
	include grbl2_mle.inc     -- The GRBL maxmimum likelihood estimation procedures

	include grbl2_batch.inc   -- The GRBL2 procedures used to implement the "command file with
				     keywords" interface used by DISCRETE (and other GRBL2 programs)


 DISCRETE-specific files:

   A misc. set of useful procedures.

	include discrete.prc     -- Some miscellaneous procedure (such as the WTP calculation)

   These contain code for some of DISCRETE's useful file creation & manipulation capabilities.

	include discrete.STA  -- Simple statistics
	include discrete.CRE  -- Create a new dataset, with new variables  
	include discrete.Cvt  -- Convert a 1-row to multi row dataset (for use by MIXED model)
	include discrete.mak   -- Convert excel and  ascii  files to gauss  data files

   These next are the "model specific" files

  	include mbe.m2     --  PROBIT and LOGIT models
	include mbe.m2c    --  MNL models
	include mbe.m2d    --  nested  MNL modeo
	include mbe.m2e    --  Mixed MNL models (several variants)
	include discrete.dou   -- single & double bounded logit and probit, etc

   This contains the estimation procedures -- that compute likelihoods, gradients, and hessians.

	include discrete.mle   -- The "maxlikc" called-by procedures. These are where the actual
			          likelihood, gradient, etc functions (for the various models) are coded.
			          Note that these are designed to be used by the MAXLIKC procedure
			          (as contained in GRBL2_MLE.INC).
			          They should be not too difficult to modify for use under GAUSS's, or someone
				  elses, maximization libraries.

       Note that DISCRETE.MLE contains a fair amount of documentation on how to use MAXLIKC for your own
       models. There are a lot of options, including support for relatively simple
       constrained optimization (linear less than constraints, and single coefficient equality 
       constraints).



