SET OF CODES AND DATAFILES 
==================================
used in "Distinguishing Limited Liability from Moral Hazard in a Model of Entrepreneurship"
===================================


NOTE: Please note these codes are cleaned-up and slightly lightened version of the ones used in the paper. The clean-up and commenting process may have caused some bugs - let me know if you notice something missing at:

akaraiva@sfu.ca

Address any other questions on the codes to the above address as well.

Put all files in the same folder. The computation codes can compute the linear programs with both Matlab's internal routine (linprog) or the commercial library CPLEX. CPLEX is much faster - up to 15 times. Currently the code is set to run on CPLEX - comment/uncomment the corresponding lines in lpcomputeXX and simcomputeXX codes to change to linprog.
============================================================
============================================================

DATA FILES:
-----------------------------
1. Datmle2.mat - Thai data, a structure file, S(1) - whole sample, S(2) - Central, S(3) - NorthEast. fields used: bsp - wealth, bus - occ. status, edy - education

2. eduls.mat - education spline (see paper)
3. in_guessMH1 - MLE estimates for MH used in paper, in_guessLL1 - MLE estimates for LL

=====================================================

CODES:
------------------
1. ESTIMATION
-------------------
main program: mainMLE.m - see instructions inside code, requires input of initial parameter guess

subroutines: mlestep1, mlestep2, lpcomputeMH, lpcomputeLL, glw

---------------------------
2. REGIME COMPARISONS
--------------------------
programs (run in following order, see inside codes for instructions, requires file of MLE estimates)

MLEtest1.m - generate LL scores
scores_join.m - merge score data
Vuong.m - compute test statistics

subroutines: mlescore.m, mlestep2.m

-------------------------------
3. GENERATING SIMULATED DATA
-------------------------------
main program: mainsim.m  (run first, requires MLE estimates file)

subroutines: simcomputeMH, simcomputeLL
