Computer programs Mike Cliff (2003). Disappeared 2004. Reappeared at Reappeared 2005.

Computer Programs and Data:

On 3/2/2003 I posted minor updates to the code, documentation, and demos. The last substantial update to the code was on 12/1/00 (improved handling of user-defined weighting matrices, some additional diagnostics, and modification of the way the gradient (derivative of objective function) is calculated).

The software below is provided as is.  Although I believe it is bug-free, there are no guarantees.  I will try to maintain a list of known problems and suggested remedies. Please report any suspected errors to Mike Cliff

If you send an e-mail with the subject "Matlab User" I will add you to a mailing list to notify you of enhancements and additions. Version numbers appear in brackets after function name. All files in the GMM and MINZ packages were numbered version 1.1 on 11/6/99, regardless of the data the function was originally written or the number of previous revisions.  I will try to keep track of version changes and repost files.

If you have an older version of the software you should consider upgrading all files as several enhancements have been made to the GMM library.  The handling of the weighting matrix is different now.  The old procedure gmmW.m is replaced by an enhanced routine gmmS.m.  The former file calculated the weighting matrix assuming the user wanted to use the ``optimal'' matrix (inverse Spectral Density matrix).  Now the handling of the weighting matrix and the Spectral Density matrix are more decoupled, allowing for pre-specified weighting matrices.  The Spectral Density matrix now handles the Andrews/Andrews-Monahan procedure, in addition to the White, Hansen (truncated), Newey-West (Bartlett), and Gallant (Parzen) procedures.  Other enhancements include better printing facilities (can now easily direct output to screen, file, or suppress), plotting diagnostics, and more efficient coding in some instances.

The software is designed for use with Matlab 5.x.  It WILL NOT work with Matlab 4.x since I make heavy use of the structure variables. It may require some of the Matlab Toolboxes, I was not particularly careful in keeping track.  I also make use of several functions I have created and I may have inadvertantly excluded them below.  If you have error messages about missing .m-files, check that your put the files below in your search path.  If it still seems that there are missing files, let me know and I will see what you need.

The files for GMM and MINZ are packaged into two files for convenience.  Each of these files is available in .tar.gz form for unix and .zip form for M$ PCers.  Since the .zip file was made in unix I can't guarantee it will sucessfully unzip on a PC but it is supposed to.  To unzip the files in unix issue the commands
    gunzip gmm.tar.gz
    tar xvf gmm.tar
    gunzip minz.tar.gz
    tar xvf minz.tar.
The library program files will be put in the current directory (mine is called gmm) and the demos will be put in a subdirectory gmmex.  The PC files should be unzipped with command like pkunzip and pkunzip from the directory where you want the files to go.  Make sure you update the search path in Matlab.  For my filestructure the Matlab command is path(path,'/home/mcliff/matlab/metrics/gmm').

Econometrics Toolbox for Matlab (from J. LeSage)


GMM library for Matlab (also requires MINZ library)

Documentation gmmdoc.pdf
All GMM files .tar.gz (unix) .zip (PC)
Main Routines  
  gmm.m [1.3.3] Main GMM function
  gmmS.m [1.1.7] Calculates Spectral Density matrix
  andmon.m [1.1] For Andrews-Monahan Spectral Density matrix
  lingmmm.m [1.1.2] Moment conditions for linear model
  lingmmj.m [1.1.2] Jacobian for linear model
  lingmmh.m [1.2.1] Analytic Hessian for linear model
  msdm.m [1.1] Moment Conditions for Mean/Covar Sum Stats
  msdj.m [1.1] Jacobian for Mean/Covar Sum Stats
  objplot.m [1.1.3] Draws objective function
  prt_gmm.m [1.1.9] Printing utility
  diagw.m [1.1] Plots weighting matrix for diagnostics
Support Functions
  arma.m Est ARMA model. Only needed for andmon.m. Req. SysID Toolbox
  stdn_prb p-values of standard normal
  vec stack matix into a vector
  vech stack unique elements of symetric matrix
Demo Programs
  sumstats_d.m Summary Statistics example
  lingmm_d.m Linear GMM example
  gmm_d.m Nonlinear GMM example
    gmmdata.m Data for gmm_d
    gmmexm.m Moment condition for gmm_d
    gmmexj.m Jacobian for gmm_d
ckls_d.m CKLS Example (also does CIR and others)
    ckls.dat Data for CKLS example
    ckls_dm.m Moment condtions for ckls_d
    ckls_dj.m Jacobian for ckls_d
gmmldv_d.m Limited Dependent Variable Demo
    gmmldv.mat Data for Limited Dependent Variable example
    logitm.m Moment condtions for Logit model
    logitj.m Jacobian for Logit
    logith.m Hessian for Logit
    probititm.m Moment condtions for Probit model
    probitj.m Jacobian for Probit
    probith.m Hessian for Probit
  userw_d.m Example with User's Weighting Matrix
    userw.m User-defined weighting matrix
  hyptest_d.m Example of Hypothesis Testing

MINZ Optimization Library

All MINZ Routines .tar.gz (unix)  .zip (PC)
Main Routines
  minz.m [1.1.5] Main function
  hessz.m [1.1.4] Evaluates (approximate) Hessian
  numz.m [1.1.1] Numerical derivative
  step2.m [1.3] Line search for step size
  lsfunc.m [1.1.1] Objective function for least squares
  lsgrad.m [1.2.1] Gradient for least squares
  stepz.m [1.1.1] Another line search algorithm
Support functions
  rows.m Find rows(X)
  cols.m Find cols(X)
  mprint1.m Printing utility
Demo Programs
  rosen_d.m   Demo minimizing Rosenbrock's (banana) function
    rosen.m   Objective function for rosen_d
    roseng.m   Jacobian for rosen_d
    rosenh.m   Hessian for rosen_d
  nlsq_d.m   Nonlinear least squares
    nlsqe.m   Moment conditions for nlsq_d
    nlsqj.m   Jacobian for nlsq_d
    nlsqdat.m   Data for nlsq_d

Miscellaneous Utilities

  autocorr.m Calculate autocorrelations for a matrix.
    makelags.m Creates lags; used by autocorr
  desc.m Calculates descriptive stats.
  prt_desc.m Pretty-prints descriptive stats.
  covcorr.m Matrix with var-cov on/below diag and corr above
  prt_corr.m Pretty-prints correlations with var names
  lprintf.m Enhanced printing with symbols (e.g., 1.23a, 1.23**)
  lprintf_d.m Demo for lprintf
  mprint1.m Pretty-prints data.  Format control, row/col names
  mprint3.m Print coef. est., t-stat, p-val. in blocks
  mprint3_d.m Demo for mprint3

Matlab programs for finding Hansen-Jagannathan bounds

  hj.m Find HJ Bound/Distance
  hjm.m Moment Conditions for hj
  hjshift.m Test for Shift in HJ Bound
  hjshiftm.m Moment Conditions for hjshift
  efffront.m Generate/Plot Efficient Frontier
  kzspan.m Kan-Zhou Mean-Variance Spanning Tests
  nwse.m Newey-West SEs

Other Stuff

  .bib biblio file for LaTeX