Updated 12 Dec 2005 -- a work in progress!
            
                        The Count Models Estimator
Abstract:

    COUNT is a "GRBL2" GAUSS program  that will estimate count-data models.
    These include the plain vanilla Poisson and Negative Binomial.
    It also pseudo maximum likelihood estimators for these models;
    truncated and endogenously stratified versions,
    single and doubled bounded versions, 
    and more.


I. Introduction

  COUNT is a GRBL2 program -- please see GRBL2.TXT for a general description. In particular,
  COUNT uses "command file" to select models, variables, etc.

  COUNT currently supports the following estimators.

     POISSON and Negative Binomial  -- estimated using Maximum likelihood or robust "pseudo maximum
     likelihood"
     Truncated Poisson and Truncated Negative Binomial.
     Endogenous stratification corrected Poisson.
     Single and double hurdle Poisson.

     And more will be added.

	-----------------------------


II. Description of Commands


COUNT is built using the GRBL2 interface. GRBL2 supports a number of sophisticated
keywords for use in "commands files".

The following keywords are those that are either unique to COUNT, or are sufficiently
important that they bare repeating. Note that keywords described in GRBL2_BATCH.TXT,
but not mentioned here, WILL work in COUNT command files.

In other words, if you want to get fancy, please see GRBL2_BATCH.TXT 

IIa. List of keywords (with examples):

  MODEL :  Specify model
  LOGX  :   Use ln(x) as independent variables
  PML   :  Use pseudo maximum likelihood estimator (instead of MLE)
  X     : specify independent variables
  Y     : specify dependent variable
  WEIGHT : specify weight (typically, a population weight)


Details on COUNT keywords.

MODEL: Specify model.

   Two models are supported: POISSON and NEGBIN (Negative Binomial).
   Actually, two variants of the Negative Binomial are supported NEGBINI and NEGBINII.

   Syntax: MODEL model_name modifiers ;

    Model_name can be:
        POISSON   :  Poisson model
        NEGBINI   :  Negative Binomial I (variance/mean = constant)
        NEGBINII  :  Negative Binomial II (variance/mean = linear in mean)
        NEGBIN    :  Negative binomial (type specified using modifiers, etc).


   Several modifiers can be included. These include:

    VC=vctype  : What to use to estimate the covariance matrix:
			HESS : The hessian
			WHITE : THe "White" matrix
			BHHH  : Outer product of gradient
		  If not specified, an model specific default is used.

    HURDLE=htype  : A hurdle model.
       This can only be specified with POISSON.
       htype can be....
       SINGLE      : Single hurdle model (participants > 0)
       DOUBLE      : Double hurdle model (participants ge 0)
       DEPENDENCE  : Double hurdle model with dependence 
                     (similar to Double, but correlation between participation and quantity decisions)
    
     ENDOG=1    : Endogenously stratified model
	This can only be used with the POISSON (Negative Binomial coming soon!)

     TRUNC=limit   : Truncated model
	limit is the truncation limit. Thus, trunc=0 means "Y=0 observations removed".
        The negative binomial only supports a limit of 0.

     TYPE=nbtype    : Type of negative binomial
	 This is only used with NEGBIN. It is not used if NEGBINI or NEGBINII is the model.
	 nbtype can be:
		1 : The NegBin I model
	        2 : The NegBin II model
		BEST : The program choses which fits best


    Examples:
      MODEL POISSON :
      MODEL NEGBINII VC=HESS ;
      MODEL NEGBIN TRUNC=0 VC=BHHH ;
      MODEL POISSON HURDLE=DOUBLE ;
      MODEL POISSON ENDOG=1 ;
  
LOGX: Estimate a full log model

   Syntax: LOGX 1 0=aval
           LOGX 0 ;
    LOGX 1 means "use ln(X) as the independent variables".
    LOGX 0 means do not use ln of the indepenent variables.

    0=aval is optional. If specified, use ln(aval) for all values of X <=0.

   Example:  LOGX 1 0=0.00001 ;
   
  Note: 0/1 dummy variables will not be logged.

PML : Use pseudo-maximum likelihood estimation.			

 Pseudo-maximum likelihood estimation is a robust altenative to MLE. It does require that you specify
 the variance/mean relationship.

 PML can be used with POISSON or NEGBIN. 

 Syntax:  PML ptype ;
  
 Ptype is one of the following:
      0   :    Do not use PML -- use MLE (maximum likelihood estimation)
      1   :    The variance is a constant (this is very rarely used)
      2   :    The variance/mean ratio is a constant (similar to the NegBinI model)
      3   :    The variance mean ratio is linear in the mean (similar to the NegBinII model)
      4   :    Similar to 3, but uses the Goureiroux, Montfort, and Trognon (GMT) specification
               (3 and 4 are differ in how weights are used).


X  : Specify independent variables.

   Syntax:  X var_list;
   Example:
      X -CONST PRICE INCOME AGE COLLEGE ;

   See GRBL2_BATCH.TXT for the details.


X  : Specify dependent variable.

   Syntax:  X varname;
   Example:
      Y TRIPS ;

   See GRBL2_BATCH.TXT for the details.


WEIGHT : Specify weight variable

   Syntax: WEIGHT varname ; 
   Example:
       WEIGHT POP2000 ;

   See GRBL2_BATCH.TXT for the details.


   The WEIGHT is used as an observation replicator. See below for the technical details.


		-------------------------------------------

Technical details.

The Poisson likelihood:

   li(Y) = exp(-lambda) * lambda^Y / Y! 
   
where lambda= exp(X*Beta)   


The Negative Binomial likelihood:
             G(y+vv)           vv                uu
 pr(Y=y)=    ------       *  ( ----) ^ (vv) * ( ---- ) ^ y
             G(y+1)*G(vv)      vv+uu           vv + uu

 uu = Exp(X*Beta)
 vv  = (1/alpha)* exp(X*Beta)^K
 w  = Weight, typically population. 
 k  = constant (1 or 0:: NegBIN I or II )

 Note: variance of negative binomial is:
      Var(y)= mu +  mu*mu/vv
  
 Substutiuting k=1 into the defintion of vv, and solving, yields
 the NegBinI model:  var(y)= mu (1 + alpha)
 
 Substutiuting k=0 into the defintion of vv, and solving, yields
 the NegBinII model:  var(y)= mu (1 + alpha*mu)
 

Truncated:


Hurdle:
 Define
     zlambda = z* betaz -- parameter determining probability of being a "participant"
     lambda  = x* beta   -- parameter of a standard poisson

 Single hurdle model
    pr(y=0)= exp(-zlambda)
    pr(y>0)= [1-exp(-zlambda)] *  ( [lambda^y] / [exp(lambda)-1)* y!] )

    Note that the 2nd half of the y>0 equation is a truncated poisson.

 Double hurdel model:
    pr(y=0)=     exp(-lambda)  + [ (1-exp(-lambda)) * exp(-zlambda) ]
    pr(y>0)= [1-exp(-zlambda)] * [ exp(-lambda) * (lambda^y) / y!]
      
    Note that the 2nd half of the y>0 equation is a standard poisson.



Endogenous Stratification:






For further description of the models see...
  Poisson and Negative Binomial, MLE and pseudo-MLE:
       Cameron and Trivedi,  Journal of Applied Econometrics, 1986, pp 29-53.
  Truncated and Endogenous Stratification Poisson:
       Shaw, Journal of Econometrics, 1988, 211-223
  Truncated Negative Binomial:
      Grogger and Carson, Review of Economics and Statistics, 1991, 239-254.
  Hurdle Poisson:
      Mullahy, Journal of Econometrics, 1986, 341-265
      Shonkwiler, W133 7th Interim Report 6/94, 89-103


