MATLAB and AMPL Code for
Constrained Optimization Approaches To Structural Estimation
Che-Lin Su and Kenneth L. Judd (2011), "Constrained Optimization Approaches to Estimation of Structural Models", Econometrica, Forthcoming.
Jean-Pierre Dube, Jeremy T. Fox and Che-Lin Su (2011), " Improving the Numerical Performance of BLP Static and Dynamic Discrete Choice Random Coefficients Demand Estimation", Econometrica, Forthcoming.
Che-Lin Su (2012), Estimating Discrete-Choice Games of Incomplete Information: A Simple Static Example. Working paper, February, 2012.
Estimation of Single-Agent Dynamic Discrete-Choice Models
- AMPL Code: RustDPAMPL_NEOS.zip
- MATLAB Code: RustDP_ktrlink.zip
- Monte Carlo Code: SuJudd_Code_ECMA.zip
This zip file contains AMPL model, data, and command files that can be run on the NEOS Server for Optimization using a nonlinear constrained optimization solver such as KNITRO or SNOPT.
This zip file contains MATLAB files to generate synthetic data and estimate Rust's single-agent dynamic programming model. The optimization routine that I use within MATLAB is ktrlink, which calls Ziena Optimization's KNITRO librarie to solve the estimation problem.
The main MATLAB script file to run is "RustBusMLE_main.m"
This zip file contains all the AMPL and MATLAB files used to run Monte Carlo experiments in the paper. We implement the constrained optimization approach by calling KNITRO in both AMPL and MATLAB (with first-order analytic derivatives). We implement the NFXP algorithm in MATLAB (with first-order analytic derivatives).
Instructions: This supplement file provides instructions for running the code.
The main script to run in Matlab is "RustBusMLETableX_MC.m"
Estimation of Random-Coefficients Logit Demand Models
MATLAB Code (including both TOMLAB/KNITRO and ktrlink implementation)used for most Monte Carlo examples in the paper.
- MATLAB Code for large-scale demand models: mpecblp_ktrlink_hessian_sparse_nonlinear.zip
This zip file contains MATLAB code that calls the ktrlink solver (KNITRO solver in MATLAB). This code specifies the constraint Jacobian, Hessian and their constraint patterns in sparse matrix format to economize the memory useage. This code is suitable for solving demand models with a large number of markets and thousands or tens of thousands of observations (constraints) in the data.
Estimation of Discrete-Choice Games of Incomplete Information
- The AMPL code below illustrates the use of constrained optimization approach for estimating a discrete choice game of incomplete information. In this example, there are 256 markets (nM=256). Each market is defined by a set of Bayesian Nash equilibrium equations, parameterized by observed players type x^m = (x_a^m, x_b^m). As a result The set of equilibria and the number of equilibria in different can be different. In a market, only one equilibrium is played by the players for 250 periods (nT=250). However, the equilibria played in different markets can be different. For detailed description of the model and the estimation procedure, see Section 5 of our paper.
- AMPL Code: RustPDMMMPEC.zip
- AMPL Model File: RustPDMMMPEC.mod
- AMPL Data File: RustPDMMMPEC.dat
- AMPL Command File: RustPDMMMPECMC.run
- MATLAB script file for Monte Carlo: Available soon.
This zip file contains three AMPL files:
In the command file, I include a loop to estimate the same model using 25 different starting points in an attempt to find a global solution. You should increase the number of multi-starts when you estimate your model.
You can run the above AMPL code by typing the following command in AMPL: " include RustPDMMMPECMC.run; "
If you run the code in AMPL successfully, it should generate these output files. You can also run these AMPL code on the NEOS Server, in which case, you should use this AMPL command file RustPDMMMPEC_neos.run instead.
Back to Research Page
Updated: January 13, 2012, April, 2012.