
/* Create a log file if you want
log using "xxx.log", replace
*/
log using "D:\Advanced_Economic_Analysis\ari_kang\output_files\log_test\dataforlogit_v26Rv27R.log", replace
set more off
insheet using "D:\Advanced_Economic_Analysis\ari_kang\data_files\dataforlogit_KLW.txt"
/*dataforlogit_KLW.txt has 80 columns.
[equity_a_all_basis,... %12(3*4) columns: [current spline (3columns), lag1 spline (3columns), lag2 ...]
		npf_a_all_basis,... %24
		logasset_all_basis,... %36
		realEst_own_a_all_basis,...  %48.
		roa_annual_all_basis,... %60
		assGrowth_1y_all_basis,... %72
        unemp_all, House, Senate, yearq, Bclose]; %73~76, 77, 78, 79, 80

To install the estout package, type
. ssc install estout, replace
in Stata.
see: http://repec.org/bocode/e/estout/installation.html
		*/

eststo prob_est: logit v80 v1-v78
matrix V = e(V)
/* note mat2txt has to be installed
ssc install mat2txt

see http://statadaily.com/tag/mat2txt
*/

mat2txt, matrix(V) saving("D:\Advanced_Economic_Analysis\ari_kang\output_files\test\logit_covb_KLW.txt") replace
/* After saving this, covariance matrix of estimator is edited so that no names appear and Matlab can read.
The edited file name is logit_covb_KLW_nonames.txt */

estout prob_est using "D:\Advanced_Economic_Analysis\ari_kang\output_files\test\logit_beta_KLW.txt", c(b) replace
estout prob_est using "D:\Advanced_Economic_Analysis\ari_kang\output_files\test\logit_se_KLW.txt", c(se) replace

predict xhat
outsheet xhat using "D:\Advanced_Economic_Analysis\ari_kang\output_files\test\logit_predict_KLW.txt", nonames replace
