I am trying to replicate the results of this paper (https://www.aeaweb.org/articles?id=10.1257/pol.20170144) with Stata 17. I am working with a panel dataset, I have yearly observations of CO2 emissions for 15 countries starting from 1960 to 2005, as well as other variables (GDP per capita, gas consumption per capita, etc.). Here's an example:
I use the synth package developed by Hainmueller, Abadie and Diamond to perform synthetic control. If I specify the option "nested", a nested optimization will be performed using the constrained quadratic programming routine and Stata's ml optimizer.
I want to perform synthetic control using the Nelder-Mead maximization technique, but the option "technique()" allows only to perform one among the following techniques: modified Newton-Raphson, Davidon-Fletcher-Powell, Broyden-Fletcher-Goldfarb-Shanno and Berndt-Hall-Hall-Hausman. Is there a way to perform synthetic control using Nelder-Mead in Stata?
PS. As this is my first question on this forum, any feedback on how to post a question here is highly appreciated!
Code:
clear input byte Countryno str13 country int year double(CO2_transport_capita GDP_per_capita gas_cons_capita vehicles_capita urban_pop pop_density) 1 "Australia" 1960 2.092156679764865 12290.4008293509 399.45596141557076 265.71014828338605 81.529 1.33768220454812 1 "Australia" 1961 2.047123914909854 12370.5105471806 407.42153963560054 275.6872237282142 81.941 1.3645652994545905 1 "Australia" 1962 2.094582014522435 12828.9886236666 426.8292682926829 284.27369858994746 82.337 1.3982791611887064 1 "Australia" 1963 2.2264840182648404 13668.1783745589 448.7671232876712 322.27395014835514 82.727 1.4253543860562592 1 "Australia" 1964 2.2906778902122324 13973.7438509531 476.4036894421062 334.7090969445533 83.11 1.4536011350767348 1 "Australia" 1965 2.355988760098349 13947.1397971169 495.69722514928 347.31345144717363 83.485 1.4823685614985096 1 "Australia" 1966 2.357737533258948 14588.7975484633 503.3902669298772 357.810391894425 83.855 1.5166031006339247 1 "Australia" 1967 2.4637681159420293 14907.2601756665 524.281718789728 351.07629388558945 84.217 1.5358681644819911 1 "Australia" 1968 2.58306270297277 15775.699805738 545.1744524939628 363.57207412520023 84.573 1.5632037280501934 1 "Australia" 1969 2.716301068254098 16599.5638645924 571.1489847508766 377.308371394745 84.922 1.5962667430326856 1 "Australia" 1970 2.569760933877029 16750.8665883324 593.3477252738467 389.2886213755416 85.265 1.62802806451193 1 "Australia" 1971 2.5531421504212726 16967.5687971994 603.3856380922934 389.48226699169226 85.6 1.6840008851515822 1 "Australia" 1972 2.5794945738787285 17490.1572460913 626.8498140699703 400.62973275701887 85.681 1.7152415292295276 1 "Australia" 1973 2.8161434977578472 18647.7556983189 664.7234678624812 418.422986029599 85.761 1.7416659073454563 1 "Australia" 1974 2.824455294031917 17863.2021265445 662.9016978794724 430.7955964473754 85.841 1.7863139945068534 1 "Australia" 1975 2.9007413805513567 17681.605486542 680.5585546678184 447.37222988152195 85.921 1.8084427840620647 1 "Australia" 1976 2.963728354592746 18179.9884724148 699.9216133399843 456.16539963239694 86 1.826666493107533 1 "Australia" 1977 3.120772266065389 18103.1988722163 725.4791431792559 469.48559864273113 85.94 1.8473634198091717 1 "Australia" 1978 3.254631564284719 18836.0704930921 743.4183033848726 482.38159509593464 85.881 1.868971531963084 1 "Australia" 1979 3.296127876533003 19297.5627301093 757.5444398511781 489.87601761381137 85.821 1.8892779506137485 1 "Australia" 1980 3.339912877756602 19705.8669871579 742.9213177239313 491.5441921756136 85.76 1.912448094971558 1 "Australia" 1981 3.344275473973337 20401.4029356559 734.5079386346888 504.4437616396864 85.7 1.9430378922978795 1 "Australia" 1982 3.363420740545526 19630.9278058492 742.1926472526025 522.1212016245879 85.64 1.9757103992293974 1 "Australia" 1983 3.286485783069816 20482.0192541605 722.1029344784956 529.0968370977973 85.58 2.000572745141429 1 "Australia" 1984 3.38973237261966 21001.9391952442 730.4426145136388 539.0230886738075 85.52 2.023352381448264 1 "Australia" 1985 3.440157380378221 21281.9813866455 732.3264373651479 549.7593094794391 85.46 2.0512086224177657 1 "Australia" 1986 3.4747540328622084 21371.3875446146 733.8435798831345 553.4644036606795 85.4 2.0851047212423364 1 "Australia" 1987 3.4801000989922466 22680.1385351427 721.9670558722078 554.9016562966794 85.4 2.117061296747068 1 "Australia" 1988 3.5554856582910928 23976.7872215249 735.3528266050496 558.8606060606061 85.4 2.1519857334392043 1 "Australia" 1989 3.604053668284328 24616.5379807033 745.4324864401941 564.8511904761905 85.4 2.188719524100855 1 "Australia" 1990 3.5974005426279363 24053.3955943188 758.4485294548523 571.0572429906541 85.4 2.221352980227276 1 "Australia" 1991 3.469682943763018 23827.3894926357 716.7900948854432 558.4201388888888 85.4 2.2498470510133686 1 "Australia" 1992 3.5124321234638467 24496.2443671283 711.689054015433 569.1538021726701 85.566 2.277312783931895 1 "Australia" 1993 3.5399332088073807 25263.6270165308 710.4771608082866 571.2911077149487 85.748 2.299701912187756 1 "Australia" 1994 3.5939512741528983 26380.661060725 715.5418650238029 580.3921568627451 85.928 2.3241737500488133 1 "Australia" 1995 3.699092518813634 27463.3054981186 716.9654714475432 589.4244604316547 86.106 2.352420499069289 1 "Australia" 1996 3.7851564633280543 28405.3919163355 712.9048113156027 606.3989071038251 86.283 2.3835309737969097 1 "Australia" 1997 3.8159529081384673 29473.0494263664 705.7838742776908 613.5783783783784 86.504 2.410345859963813 1 "Australia" 1998 3.7763882208326653 30442.3119275183 700.2298113409224 625.8930481283423 86.727 2.4355987139268187 1 "Australia" 1999 3.8058755151643244 31649.6552334523 703.0539997886506 624.7296587926509 86.947 2.4635851242466447 1 "Australia" 2000 3.876677282932178 31808.5517218924 711.0113298177831 627.3394255874674 87.165 2.4931335667703682 1 "Australia" 2001 3.7943646010405394 32638.4236134744 670.8391284191006 625.0515463917526 87.378 2.5269775978548092 1 "Australia" 2002 3.834841283572672 33289.3632545641 695.2176435266698 632.3193337057539 87.541 2.558009970972235 1 "Australia" 2003 3.8013812238004765 34283.1060245603 689.8579571157152 643.8241526429509 87.695 2.5897712924514793 1 "Australia" 2004 3.8936971491598515 34903.0118501845 723.2429424565518 654.8718055803696 87.849 2.6199705817268266 1 "Australia" 2005 3.8500009806421245 35506.2815141701 691.9410830211623 665.8915468459458 88 2.6547778660036707 2 "Belgium" 1960 .7658281994985736 9337.64958633288 117.98779678437369 101.61746939279202 92.46 278.8997257769653 2 "Belgium" 1961 .7905097023632974 9698.11677816021 125.43625029235793 110.89324250087887 92.554 279.28092626447295 2 "Belgium" 1962 .8047217864216322 10159.8373809861 129.818325922735 120.92189288397697 92.679 280.865326020719 2 "Belgium" 1963 .80733968655844 10431.6745352363 134.12603326024217 132.7233453700913 92.835 282.84582571602704 2 "Belgium" 1964 .8338564485200807 11092.3387976455 148.64397560575352 146.25797908098343 92.988 285.405240706886 2 "Belgium" 1965 .8939452328574116 11461.5755596638 164.31262849802303 166.33193998746714 93.137 287.8732480195 2 "Belgium" 1966 .83544933267435 11744.4608089791 160.47764191697 191.28019239205966 93.284 289.7014015844 2 "Belgium" 1967 .9028293628498347 12132.742006814 175.9734457531585 184.34234472433045 93.428 291.194393662401 2 "Belgium" 1968 1.0178031337940165 12590.2722584439 193.37219906607467 215.12476401019103 93.569 292.1998781230961 2 "Belgium" 1969 1.0522461463947042 13450.3643813944 209.7235422814272 226.0206896497199 93.707 292.90067032297395 2 "Belgium" 1970 1.1703114965290944 14252.7596107932 228.15895812863673 240.91097689027924 93.843 293.66240097501503 2 "Belgium" 1971 1.210565893551664 14668.6369542211 238.59829908772332 250.82734842591438 93.976 294.728823887873 2 "Belgium" 1972 1.289244334970804 15573.9057384289 259.29051401409623 262.5025994158916 94.106 295.825716026813 2 "Belgium" 1973 1.3159893735397854 16700.203463619 263.7111310938931 274.1272628220217 94.233 296.709323583181 2 "Belgium" 1974 1.2719470992801272 17212.4412778826 256.640653660061 285.4861688142071 94.358 297.623400365631 2 "Belgium" 1975 1.3560255900088767 16833.34979536 282.1227055210342 296.81304680894175 94.48 298.446069469835 2 "Belgium" 1976 1.4391600438653538 17881.7145359953 291.702361332652 309.0315571467624 94.6 298.9335770871419 2 "Belgium" 1977 1.5075748004294451 18214.3594171213 302.53221703624627 322.64766786805035 94.806 299.26873857403996 2 "Belgium" 1978 1.5468212214115018 18889.6595527448 315.3604632089284 332.88905294628063 95.005 299.512492382693 2 "Belgium" 1979 1.6358016981875803 19542.5887184122 317.2094664890131 345.55101368279344 95.196 299.7257769652649 2 "Belgium" 1980 1.6076286594851814 20262.2052655668 298.5016495182895 368.63715141363156 95.381 300.03046922608195 2 "Belgium" 1981 1.565070308476068 18990.1341313303 275.38340165343647 351.4398926963628 95.535 300.18281535649 2 "Belgium" 1982 1.583758129189007 18401.4500015241 270.4868143765467 353.998679891537 95.637 300.30469226081703 2 "Belgium" 1983 1.618382388752699 17862.9249534197 261.2748997516113 357.70419332063165 95.737 300.30469226081703 2 "Belgium" 1984 1.6214507174361354 17901.2810668614 262.69936842566676 361.7995398817316 95.835 300.21328458257193 2 "Belgium" 1985 1.6605283584160693 17741.8355187227 253.69465023815445 366.7867940539882 95.93 300.36563071297996 2 "Belgium" 1986 1.8100101776314586 18683.4485994807 275.81107468669836 371.0647494869762 96.023 300.48750761730696 2 "Belgium" 1987 1.8631777118961923 19444.1440230618 287.4298623517943 384.33704087199527 96.115 300.73126142596 2 "Belgium" 1988 2.007743344956969 20955.3244914384 296.31383169535945 395.3409759276103 96.204 301.70627666057294 2 "Belgium" 1989 2.042726800786943 22174.1502075456 289.50369487014945 408.70781462449804 96.292 302.803168799513 2 "Belgium" 1990 2.006545552245982 23044.8914109019 273.5924860487396 422.0320664586743 96.377 303.68677635588097 2 "Belgium" 1991 2.049080782361033 23491.9390406788 273.67722839534184 434.1785151380354 96.461 304.84460694698396 2 "Belgium" 1992 2.179159352197347 24233.7621192089 288.9949565750982 438.74492854084696 96.542 306.06337599024994 2 "Belgium" 1993 2.2172696149278965 24355.8971645373 281.5218442209436 446.5189709140522 96.622 307.28214503351603 2 "Belgium" 1994 2.248012303369359 25267.6176101506 280.6555377865264 459.45553062990786 96.7 308.22669104204795 2 "Belgium" 1995 2.2294980147109382 26120.0587547085 279.4764546759331 464.96773876905803 96.777 308.86654478976203 2 "Belgium" 1996 2.324588345532089 26172.5966638384 269.675877950546 472.83883668998845 96.851 309.47592931139496 2 "Belgium" 1997 2.325845218340193 27685.6357886652 248.98723093295564 481.1320373336638 96.924 310.207190737355 2 "Belgium" 1998 2.360088319052577 28587.6796746813 246.2019043795712 489.42050882637574 96.996 310.87751371115195 2 "Belgium" 1999 2.372286916857211 29682.3192116252 234.09954158928946 500.08665303013044 97.065 311.57830591102993 2 "Belgium" 2000 2.3714181197414947 31589.3844335182 218.99768320936474 510.48086165754745 97.128 312.370505789153 2 "Belgium" 2001 2.43910263576683 31735.7962491225 212.510098118226 516.9614093498608 97.184 313.4369287020109 2 "Belgium" 2002 2.4194832274164226 32457.0473545754 201.97845982472296 519.9616755821838 97.239 314.838513101767 2 "Belgium" 2003 2.4999679553066643 31523.1214697546 202.86941194759166 533.4391873479485 97.292 314.3935405240707 2 "Belgium" 2004 2.5448278820247734 31763.9643330839 185.3924384642482 546.7320233563054 97.345 315.04442413162707 2 "Belgium" 2005 2.4592940079783427 31678.7111483935 168.15196127504228 559.4894743535823 97.397 315.5444 3 "Canada" 1960 2.7997082362290397 11758.0418752576 657.0436141943978 292.4517783973028 69.061 1.94220369440525 3 "Canada" 1961 2.7639428602703737 11934.4537737086 659.6245416233376 300.8422619336053 69.668 2.0092351578213474 3 "Canada" 1962 2.8403352315461476 12445.8107005251 682.6582142473408 309.1797386760763 70.494 2.0469543663557856 3 "Canada" 1963 2.938726007171483 12820.8184647129 711.6642058637418 318.96505103082416 71.307 2.085443354656233 3 "Canada" 1964 3.0566623544631306 13459.0420509267 735.9379042690815 328.62051925079186 72.107 2.125141996874694 3 "Canada" 1965 3.175119422705559 14110.3285865656 765.7790425856286 337.4232635414848 72.892 2.1639608907891454 3 "Canada" 1966 3.316041500399043 14758.4593706042 796.1392657621708 346.40827724868734 73.642 2.204649249849618 3 "Canada" 1967 3.425436018028611 14920.3096577685 822.1634332745443 352.50873923684514 74.155 2.2446777976820833 end
I use the synth package developed by Hainmueller, Abadie and Diamond to perform synthetic control. If I specify the option "nested", a nested optimization will be performed using the constrained quadratic programming routine and Stata's ml optimizer.
Code:
tsset Countryno year synth CO2_transport_capita GDP_per_capita gas_cons_capita vehicles_capita urban_pop CO2_transport_capita(1989) CO2_transport_capita(1980) CO2_transport_capita(1970), trunit(13) trperiod(1990) xperiod(1980(1)1989) unitnames(country) nested allopt technique(bfgs) resultsperiod(1960(1)2005) fig
PS. As this is my first question on this forum, any feedback on how to post a question here is highly appreciated!

Comment