Dear Statalisters,
I am using the tuples command to generate groups of four and only four independent variables. Then I am using the synth command to generate all the synthetic controls possible, so I can choose the best one based on the RMSPE of each of them. That is why I'm exporting the RMSPE and V_matrix results to Excel.
Here is my code
The problem is that I get error 198 (invalid syntax), which says that one of the variables in the first tuple is invalid. Does anyone know how to solve this?
Here is my log file, just in case
Synthetic Control Method for Comparative Case Studies
I am using the tuples command to generate groups of four and only four independent variables. Then I am using the synth command to generate all the synthetic controls possible, so I can choose the best one based on the RMSPE of each of them. That is why I'm exporting the RMSPE and V_matrix results to Excel.
Here is my code
Code:
tuples Longituddelineas Numerodeestaciones Pasosanivelcantidad Pasosvehiculares Sealamientoenkmdelinea Electrico calidad_deficitaria calidad_deficitaria_v2 conexiones_deficitarias conexiones_insuf hacinamiento tenencia_informal educ_j_superior, varlist min(4) max(4) forvalues i=1/715 { synth Y1 Y1(75(1)87) Y1(37(1)48) `tuple`i'', trunit(7) xperiod(81(1)87) nested trperiod(88) keep(synth_Y1`tuple`i'') replace putexcel A1=matrix(e(RMSPE)) using RMSPE_VmatrixY1`tuple`i'', modify putexcel B1=matrix(e(V_matrix)) using RMSPE_VmatrixY1`tuple`i'', modify } }
Here is my log file, just in case
Synthetic Control Method for Comparative Case Studies
Code:
---------------------------------------------------------------------------------------------- First Step: Data Setup ---------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------- Data Setup successful ---------------------------------------------------------------------------------------------- Treated Unit: CONLP Control Units: BAGC, BAMCGB, CONEZ, CONGL, EZCAN, MERLOB, MORMERCE, PALAB, RETJLS, RETTIG, RetMIT, TEMHAE, URQ, VBALLZAR, VICCDS ---------------------------------------------------------------------------------------------- Dependent Variable: Cumplimiento1 MSPE minimized for periods: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Results obtained for periods: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 99 100 101 102 ---------------------------------------------------------------------------------------------- Predictors: Cumplimiento1(75(1)87) Cumplimiento1(37(1)48) conexiones_insuf hacinamiento tenencia_informal educ_j_superior ---------------------------------------------------------------------------------------------- Unless period is specified predictors are averaged over: 81 82 83 84 85 86 87 ---------------------------------------------------------------------------------------------- Second Step: Run Optimization ---------------------------------------------------------------------------------------------- Nested optimization requested Starting nested optimization module Optimization done ---------------------------------------------------------------------------------------------- Optimization done ---------------------------------------------------------------------------------------------- Third Step: Obtain Results ---------------------------------------------------------------------------------------------- Loss: Root Mean Squared Prediction Error --------------------- RMSPE | .0262334 --------------------- ---------------------------------------------------------------------------------------------- Unit Weights: ----------------------- Co_No | Unit_Weight ----------+------------ BAGC | .302 BAMCGB | 0 CONEZ | 0 CONGL | .43 EZCAN | 0 MERLOB | 0 MORMERCE | 0 PALAB | 0 RETJLS | 0 RETTIG | 0 RetMIT | .14 TEMHAE | 0 URQ | .128 VBALLZAR | 0 VICCDS | 0 ----------------------- ---------------------------------------------------------------------------------------------- Predictor Balance: ------------------------------------------------------ | Treated Synthetic -------------------------------+---------------------- Cumplimiento1(75(1)87) | .9426685 .9407001 Cumplimiento1(37(1)48) | .958632 .9525271 conexiones_insuf | .108022 .2052907 hacinamiento | .0226488 .0248216 tenencia_informal | .1002226 .1012253 educ_j_superior | .3077788 .3077275 ------------------------------------------------------ ---------------------------------------------------------------------------------------------- invalid 'hacinamiento' r(198); end of do-file r(198);
Comment