This file describes the procedure of getting estimates from Kang, Lowery & Wardlaw (RFS, 2015).

Notes:
	- Both Stata and MatLab are utilized.
	- It is assumed that the pre-estimation steps are completed and the results are stored in data files (in this case, coeff_resid_KLW.xlsx and cost_covb_KLW_nonames.txt.) Most of pre-estimations are simple OLS or AR process.)
	- This procedure only explains the basic model reported in the paper. Neither other models (which are reported for more complete picture of the model/data in the paper) nor policy results are included here.
	- Please disregard the path of the input files and output files written in the codes. One should use one's own relevant file path.
	- To run some codes, you will need CompEcon ToolBox for Matlab.
	- There could be small discrepancies between what you get and what the paper reports due to the computer specification and precision differences.
	
[data file]
dataforlogit_KLW.txt
coeff_resid_KLW.xlsx
ccpdata_pvar_KLW.mat
rng_KLW.mat
theta_GMM1st_initial_KLW.mat (for initial seed for structural parameter estimates)
cost_covb_KLW_nonames.txt (this file is used in "Avar_param_obj_KLW.m". The suffix "_nonames" indicates that the first row and the first column of variable names are deleted so that Matlab can read the file.  Also for this file, the last column and the last numeric row are removed since those are correlation with "sigma".)

[output file]
logit_covb_KLW.txt (from logit_KLW.do)
logit_covb_KLW_nonames.txt (by deleting the first row and the first column of variable names from "logit_covb_KLW.txt")
logit_beta_KLW.txt (from logit_KLW.do)
logit_se_KLW.txt (from logit_KLW.do)
logit_predict_KLW.txt (from logit_KLW.do)
ccpnext_param_sim5000_KLW.txt (from ccpnext_param_KLW.m)
dataforparam_KLW.mat (from param_data_prep_KLW.m)
GMM1st_KLW.mat (from GMM1st_KLW.m)
theta_GMM1st_KLW.mat (from afterGMM1st_KLW.m)
findmin_KLW.mat (from findmin_cont_KLW.m)
theta_KLW.mat (from theta_save_KLW.m)
T_KLW.mat (from Avar_param_obj_KLW.m)

[function file]
param_obj_KLW.m 
param_obj_cont_KLW.m
fn_obj_KLW.m
fn_obj_cont_KLW.m

[execution file]
logit_KLW.do
ccpnext_param_KLW.m (it takes about 450 seconds.) 
param_data_prep_KLW.m 
GMM1st_KLW.m
afterGMM1st_KLW.m
findmin_cont_KLW.m (it takes about 650 seconds.)
theta_save_KLW.m
Avar_param_obj_KLW.m
(GMM1st_051013_KLW.m, afterGMM1st_v28_KLW.m) 

1. Run 
	logit_KLW.do
	: estimates Logit model of CCP of choice of closing a bank.
	
2. Run
	ccpnext_param_KLW.m	
	: generates next period CCPs with 5000 simulation draws.
	
3. Run 
	param_data_prep_KLW.m
	: prepares a data set ready for estimating structural parameters.
	
4. Run
	GMM1st_KLW.m
	: first pass of finding local min of GMM problem.
	(note that this code uses the initial value from the previous version. Refer GMM1st_051013_KLW.m and afterGMM1st_v28_KLW.m to see how the previous version is estimated at this stage.)
	: needs a function  - param_obj_KLW.m
	
5. Run
	afterGMM1st_KLW.m
	: checks how the objective function value behaves from the previous step.
	: needs a function - fn_obj_KLW.m
		
6. Run
	findmin_cont_KLW.m
	: refines the results from the previous steps using MatLab "fmincon" function.
	: needs an objective function for "fmincon" - param_obj_cont_KLW.m
	: needs a function - fn_obj_cont_KLW.m (continuously updated GMM)
	
7. Run
	theta_save_KLW.m
	: a simple code to save the main results in a better format.
	: you can skip this step if your code incorporates this step in the previous step.
		
8. Run
	Avar_param_obj_KLW.m
	: calculates Asymptotic variance of the structural parameter estimates along with t-statistics.