Commits

stevejb  committed c0f6848

This particular version is borked

  • Participants
  • Parent commits baa3e8a

Comments (0)

Files changed (4)

File data/iss_calc_moments_byIndustry.R

 
 save(sicLevelData, file="sicLevelData.Robj")
 save(industry_level1, file="industry_levels.Robj")
+
+##############################
+
+FF12sic = list()
+## FF12sic$nodur = matrix(c(
+##           0100,0999,
+##           2000,2399,
+##           2700,2749,
+##           2770,2799,
+##           3100,3199,
+##           3940,3989),ncol=2, byrow=TRUE)
+FF12sic$telcm = matrix(c(4800,4899), ncol=2, byrow=TRUE)
+FF12sic$shops = matrix(c(5000,5999,7200,7299,7600,7699),ncol=2, byrow=TRUE)
+
+FF12names = c("telcm", "shops")
+
+for (ffi in 1:length(FF12names)) {
+  mlist = list()
+  guides = FF12sic[[FF12names[ffi]]]
+  for(ii in 1:nrow(guides)) {
+    mltmp = subset(data.q, SIC >= guides[ii,1] & SIC <= guides[ii,2])
+    mlist[[ii]] = mltmp
+  }
+  mtmp = do.call("rbind", mlist)
+  industry_fname = paste("FF12__", FF12names[ffi], sep="")
+  print(paste("Making influence function for", industry_fname))
+  makeInfluenceFunctions(mtmp, fname = industry_fname)
+}

File siman_solve/runscript_FF12shops_DDW.sh

 
 export OMP_NUM_THREADS=16
 
-./nm_solve_lgll_d15 --rho=0.87 --sigma_v=-1.257725 --a=0.08 --gamma=-5.692843 --s=0.0077 --lambda_1=-2.407946 --lambda_2=-5.809143  --epsilon_P=-3.912023 --theta=0.7880 --prefix=/mnt/eph0/smm_ff12shops_ddw --momentlist='mean_inv,var_inv,inv_3rd_central,mean_lev,var_lev,mean_opr_income,ser_cor,var_opr_income_innov,mean_tobins_q,mean_equity_issuance,var_equity_issuance,mean_cash_bal' --datamoments='0.104859010428016,0.00494520541889343,0.000243988278979107,0.284899099288037,0.0469824512691197,0.144481524912413,0.86923679775599,0.00136627339266134,1.69000241106851,0.0091123123452546,0.000786798210175046,0.0606512332457055' --gmm_weight_matrix='/home/ec2-user/data/ddwweights/FF12__shops_ddw_gmmweights.csv'
+./nm_solve_smmddw_loggamma_d15 --rho=0.87 --sigma_v=-1.257725 --a=0.08 --gamma=-5.692843 --s=0.0077 --lambda_1=-2.407946 --lambda_2=-5.809143  --epsilon_P=-3.912023 --theta=0.7880 --prefix=/mnt/eph0/smm_ff12shops_ddw --momentlist='mean_inv,var_inv,inv_3rd_central,mean_lev,var_lev,mean_opr_income,ser_cor,var_opr_income_innov,mean_tobins_q,mean_equity_issuance,var_equity_issuance,mean_cash_bal' --datamoments='0.104859010428016,0.00494520541889343,0.000243988278979107,0.284899099288037,0.0469824512691197,0.144481524912413,0.86923679775599,0.00136627339266134,1.69000241106851,0.0091123123452546,0.000786798210175046,0.0606512332457055' --gmm_weight_matrix='/home/ec2-user/data/ddwweights/FF12__shops_ddw_gmmweights.csv'

File siman_solve/runscript_FF12telcm_DDW.sh

 
 export OMP_NUM_THREADS=16
 
-./nm_solve_lgll_d15 --rho=0.797996605280155 --sigma_v=-1.257725 --a=0.08 --gamma=-5.692843 --s=0.0077 --lambda_1=-2.407946 --lambda_2=-5.809143  --epsilon_P=-3.912023 --theta=0.7880 --prefix=/mnt/eph0/smm_ff12telcm_ddw --momentlist='mean_inv,var_inv,inv_3rd_central,mean_lev,var_lev,mean_opr_income,ser_cor,var_opr_income_innov,mean_tobins_q,mean_equity_issuance,var_equity_issuance,mean_cash_bal' --datamoments='0.119092810534722,0.00594676954210437,0.00065675056798056,0.451475047131944,0.106523231032251,0.149406942222222,0.797996605280155,0.00134521259526338,2.91983779138889,0.0215880931567361,0.00300483544644659,0.0547023238805556' --gmm_weight_matrix='/home/ec2-user/data/ddwweights/FF12__telcm_ddw_gmmweights.csv'
+./nm_solve_smmddw_loggamma_d15 --rho=0.797996605280155 --sigma_v=-1.257725 --a=0.08 --gamma=-5.692843 --s=0.0077 --lambda_1=-2.407946 --lambda_2=-5.809143 --theta=0.7880 --prefix=/mnt/eph0/smm_ff12telcm_ddw --momentlist='mean_inv,var_inv,inv_3rd_central,mean_lev,var_lev,mean_opr_income,ser_cor,var_opr_income_innov,mean_tobins_q,mean_equity_issuance,var_equity_issuance,mean_cash_bal' --datamoments='0.119092810534722,0.00594676954210437,0.00065675056798056,0.451475047131944,0.106523231032251,0.149406942222222,0.797996605280155,0.00134521259526338,2.91983779138889,0.0215880931567361,0.00300483544644659,0.0547023238805556' --gmm_weight_matrix='/home/ec2-user/data/ddwweights/FF12__telcm_ddw_gmmweights.csv'

File solve_isC.cpp

         // // cash balance
         if(debt < 0) {
 	  double cbtmp = debt/k_prev * -1.0;
+	  // double cbtmp = debt * -1.0;
           cash_balance_MOMENT.push_back(cbtmp);
         }
 	cash_bal_RAW(n,t-1) = debt/k_prev;
   cout << "start cash bal" << endl;
   VectorXd cash_bal_vec(cash_balance_MOMENT.size());
   MatrixRMXd cash_bal_mat = MatrixRMXd(cash_balance_MOMENT.size(), 1);
+  cout << "DDW Cash bal vec: " <<  cash_bal_mat.rows() << endl;
   for(int cii = 0; cii < cash_balance_MOMENT.size(); cii++) {
     cash_bal_vec(cii) = cash_balance_MOMENT[cii];
     cash_bal_mat(cii,0) = cash_balance_MOMENT[cii];
   for(int n = 0; n < Nsim; n++) {
     double zpp_TRENDED_initial = 0.0;
     for(int t = 0; t < T; t++) {
-
+      double cash_indic;
+      double cash_tmp;
 #ifdef BARR_FIXINDEX
       cout << "start mapping" << endl;
 #endif
         d_indic = max(p_prev, 0.0);
         leverage = d_indic / k_prev;
 
+	cash_indic = -1.0 * min(p_prev, 0.0);
+	cash_tmp = cash_indic / k_prev;
 
       } else { // else t <= 1
         value_cur       = -99999.99;
         // if(debt < 0) {
         //   cash_balance_MOMENT.push_back(debt/k_prev);
         // }
-	cash_bal_RAW(n,t-1) = debt/k_prev;
+	// cash_bal_RAW(n,t-1) = debt/k_prev; NO	
+	// cash_bal_RAW(n,t-1) = debt; NO
+	// cash_bal_RAW(n,t-1) = leverage; NO
+	// cash_bal_RAW(n, t-1) = p_prev/k_prev; NO 
+	cash_bal_RAW(n, t-1) = cash_tmp;
 
 #ifdef BARR_FIXINDEX
 	cout << "[END] Recording moments at t=" << t << endl;
 #ifdef BARR_FIXINDEX
   cout << "debt_RAW is " << debt_RAW.rows() << "x" << debt_RAW.cols() << endl;
 #endif
-  for(int n = 0; n < Nsim; n++) {
-    for(int t = 0; t < (T-1); t++) {
-      if(cash_bal_RAW(n,t) < 0.0) {
-	double cbtmp = cash_bal_RAW(n,t) * -1.0;
-	cash_balance_MOMENT.push_back(cbtmp);
+  int cmdNegs = 0;
+  for(int nnnn = 0; nnnn < Nsim; nnnn++) {
+    for(int tttt = 0; tttt < (T-1); tttt++) {
+      if(cash_bal_RAW(nnnn,tttt) > 0) {
+	cmdNegs++;
+	cash_balance_MOMENT.push_back(cash_bal_RAW(nnnn,tttt));
       }
     }
   }
+  cout << "Negs: " << cmdNegs <<  " / " << int(Nsim * (T-1)) << endl;
   cout << "End CBM" << endl;
   
 #ifdef DO_FULL_SIM_REPORT
     cash_bal_vec(cii) = cash_balance_MOMENT[cii];
     cash_bal_mat(cii,0) = cash_balance_MOMENT[cii];
   }
-  //  cout << "CBM MEAN: " << cash_bal_mat.mean() << endl;
-
+  cout << "CBM MEAN: " << cash_bal_mat.mean() << endl;
+  cout << "CBM Rows: " << cash_bal_mat.rows() << endl;
   RegressionReg opr_income_reg;
   opr_income_reg = pooledOLSAutoreg(operating_income_MOMENT);
 
     exit(1);
   }
 
+  if(par.rho >= 1.0) {
+    cout << "Hey Dad:Energy=" << 99999999.9 << endl;
+    exit(0);
+  }
 
   // LET EPSILON_P actually be the log of epsilon_P. 
   // THUS, WE EXPONENTIATE IT 
 
 
     Nsim = 30000;
-    int NS_economies = 12;
+    int NS_economies = 1;
     vector<MapStringDoubleType> allTrendedMoments;
     MapStringDoubleType trendedMoments_tmp;
     //MapStringDoubleType trendedMoments;