Economics 8747: Numerical Assignment #1

Fall 2003

Contact: Collin StarkweatherEconomics Department
Phone: (303) 492-4784 (do not leave messages)University of Colorado
E-mail: Boulder, CO 80309-0256

Resources


An online introduction to Gauss.
Gauss 5.0 Quick Start Guide
Gauss 5.0 User's Guide
Gauss 5.0 Language Reference

Example: Poisson


The Gauss program
The Gauss data file

Example: Probit


The Gauss program
The Gauss data file

Example: GMM


The Gauss program
The Gauss data file
The Gauss program: 4 moments
The Gauss output: 4 moments

Extra Documentation


MAXLIK documentation
sqpSolve documentation
Please note: An issue was discovered Tuesday, September 30 with the GMM estimation code. Please see this description of the issue for more information, including additional reporting requirements. A new Gauss file has been posted with a correction made. I am not close to a copy of Gauss at the moment, so the new code is currently untested. However, the change is only 3 lines. If there are any problems, you are undoubtedly well-versed enough in Gauss by now to correct them ;-)

Getting Started


There is a bug in one of the header files for the maximum likelihood libraries in Gauss 5.0 in the computer labs. So the first thing you should do is create a working directory for yourself. I called mine D:\collin. Place the file MAXLIK.DEC in your working directory. This file is a corrected version of the buggy header file.

Now open Gauss by selecting Start | Programs | Gauss 5.0 | Gauss 5.0. In the Gauss command window, issue the command chdir to change Gauss' working directory to your working directory:

>> chdir "D:/collin";
You are now ready to proceed.

Assignment 0: Poisson Maximum Likelihood Estimation


Download the Poisson maximum likelihood example code and data files. Place them in your working directory. Now run the Poisson example by typing
>> run poisson.gss;
You should get output that looks like this
===============================================================================
                     Poisson Maximum Likelihood Estimation                     
===============================================================================
 MAXLIK Version 4.0.22                                     9/15/2003   4:11 pm
===============================================================================

return code =    0
normal convergence

Mean log-likelihood         1.57230
Number of cases     256

Covariance matrix of the parameters computed by the following method:
Inverse of computed Hessian

Parameters    Estimates     Std. err.  Est./s.e.  Prob.    Gradient
------------------------------------------------------------------
Gamma            4.0195        0.1253   32.078   0.0000      0.0000
Correlation matrix of the parameters
   1.000
Number of iterations    1
Minutes to convergence     0.00183
Now create a new dataset which will produce an estimate close to 8.0 (rather than 4.0). You will need to know the command rndKMp to complete this assignment. See the Gauss Language Reference for an alphabetical listing of Gauss functions.

Assignment 1: Probit Maximum Likelihood Estimation


Given the sample Gauss code to perform a maximum likelihood estimation assuming a poisson distribution, adapt the code to perform a maximum likelihood estimation of a probit.

You will need the data file probit.dat to complete the assigment. You should also be familiar with Gauss matrix operators and the command cdfn. You can take a look at this online introduction for a relatively painless introduction to matrix operators and a variety of other topics.

The data file contains 3 columns of numbers. Although they were artificially generated, they might represent a binary choice; e.g., whether to work or not. The first column utility for choosing to work, for example. If it is one, the observation represents someone who gains utility over and above their reservation level from staying home and who would thus choose to work. If zero, the person would choose not to work.

The second and third columns represent features associated with the decision. Continuing with the work choice example, this may be the level of education or other household income.

To complete this assignment, you may find it useful to divide the data into observations between those that are zero and those that are not. You may also find the syntax -((-1).^w) helpful. This creates a vector from w which is equal to -1 where w is zero and 1 where it is 1.

Your results should look something like this

===============================================================================
                     Probit Maximum Likelihood Estimation                      
===============================================================================
 MAXLIK Version 4.0.22                                     9/16/2003   3:21 pm
===============================================================================

return code =    0
normal convergence

Mean log-likelihood       -0.625489
Number of cases     400

Covariance matrix of the parameters computed by the following method:
Inverse of computed Hessian

Parameters    Estimates     Std. err.  Est./s.e.  Prob.    Gradient
------------------------------------------------------------------
beta0           -0.3507        0.1749   -2.005   0.0225      0.0000
beta1            0.4427        0.2197    2.015   0.0220      0.0000
beta2           -0.5859        0.2255   -2.598   0.0047      0.0000

Correlation matrix of the parameters
   1.000  -0.663  -0.655
  -0.663   1.000   0.010
  -0.655   0.010   1.000

Number of iterations    14
Minutes to convergence     0.04792

Assignment 2: Gamma Generalized Method of Moments Estimation


The file gmmv2.gss performs a GMM estimation of a gamma distribution based on the dataset gmm.dat. The example is based on Green (4th edition) example 11.3 in section 11.5.2. The example is particularly valuable from a practical perspective because it incorporates weighting of the moment conditions to accomodate numerical problems that arise with unweighted moment equations.

The assignment consists of three parts:

  1. Increase the number of moments from two to four consistent with the estimation performed in Green.
  2. While you are making your changes, comment the code liberally to reflect what is taking place.
  3. After you have increased the number of moments from two to four comment on the estimates you receive relative to those given in Green and between two and four moments.
  4. New: Discuss the difference between the methods and results detailed here.


Last modified October 1, 2003