Open jay-sf opened 4 years ago
Thank you. We'll look into it!
On Wed, Nov 13, 2019 at 2:50 AM jaySf notifications@github.com wrote:
Hi, thank you for implementing this valuable method in R. However, I'm facing the issue that attempts to adjust the nboot often fail with an error. Please see MCVE below.
MCVE
set.seed(2247643)
nboots <- 2e2 # works most of the time nboots <- 2e3 # works most of the time NOT, especially with seed above gsynth(Y="gini.disp", D="D", X=pred.gini, data=sample.dat, parallel=FALSE, index=c("id", "time"), force="two-way", CV=TRUE, r=c(0, 4), se=TRUE, nboots=nboots)
may yield:
Error in eff.boot[, , j] <- boot$eff :
number of items to replace is not a multiple of replacement length
Sample data
sample.dat <- structure(list(id = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8), time = c(9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21), D = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), gini.disp = c(58.4, 58.5, 58.7, 58.8, 58.9, 58.8, 58.7, 58.6, 58.7, 58.8, 58.8, 58.9, 58.9, 39.1, 39.3, 39.6, 39.8, 40, 40.2, 40.4, 40.6, 40.7, 40.9, 41, 41.1, 41.2, 45.4, 45.3, 45.2, 45.2, 45.1, 45, 45, 44.9, 44.8, 44.6, 44.4, 44.3, 44.2, 39.4, 39.6, 39.7, 39.8, 39.8, 39.8, 39.9, 39.9, 39.9, 39.9, 39.9, 39.8, 39.8, 36.6, 36.5, 36.6, 36.5, 36.4, 36.4, 36.4, 36.4, 36.4, 36.5, 36.5, 36.6, 36.6, 48.4, 47.7, 46.9, 46.1, 45.5, 44.7, 44, 43.6, 43.5, 43.6, 43.5, 43.5, 43.5, 42.6, 42.3, 42, 41.6, 41.3, 41, 40.7, 40.4, 39.9, 39.5, 39.1, 38.7, 38.3, 40.2, 40.1, 39.9, 39.7, 39.5, 39.3, 39.2, 39, 38.7, 38.5, 38.2, 37.9, 37.7, 42.5, 42.7, 42.8, 43, 43.1, 43.3, 43.5, 43.7, 43.9, 44.1, 44.2, 44.2, 44.2, 40, 40.4, 40.7, 41.1, 41.5, 41.5, 41.5, 41.5, 41.5, 41.5, 41.5, 41.5, 41.3, 59.3, 59.4, 59.4, 59.5, 59.6, 59.7, 59.9, 60, 60, 59.8, 59.6, 59.5, 59.4), trade = c(101.841039320292, 98.9290812021418, 91.924729689918, 87.5250655680957, 91.8357740585774, 85.8340425151264, 90.9978228872631, 88.5053520573505, 86.3345889171215, 95.1046388023392, 96.715910335632, 86.6860199052182, 94.8997963219007, 80.5995432469935, 81.7051040340528, 116.048430162968, 110.045854160811, 97.4892431746551, 97.2871457139532, 99.6703343472122, 98.1715141146279, 65.9214438401551, 65.3543222852532, 69.5142256111434, 71.5947385281524, 75.3778157916824, 48.8972419400753, 48.1922749889095, 53.3090443862273, 55.9468360286644, 55.1726722640053, 54.132265895729, 59.4770033484288, 64.4788661639796, 55.2364851257303, 53.8947888046059, 57.5785986473131, 50.8636415698917, 54.2268646261755, 50.7976821472107, 53.9866926482482, 59.1618267897056, 59.4180038973489, 60.5340864045186, 58.3277426764957, 61.596533473438, 67.9148544916014, 71.4962867805158, 78.4871743394128, 85.6728209004978, 67.91510294823, 75.2476345357777, 132.199131675792, 130.691257437002, 122.312602490244, 129.778721888857, 119.822340319355, 110.118531709304, 108.468732616886, 123.246099398259, 127.062861757976, 120.876451250142, 115.489315893532, 104.42972895159, 113.457073552476, 70.8751772901036, 71.3159730281056, 60.93863549639, 67.1184036928501, 41.9008377881176, 50.8424494444496, 51.4662417063174, 57.4479843783725, 54.3599683102017, 56.4441652527095, 61.9657689679199, 51.6830724947176, 57.6475200499248, 35.3326795564082, 33.7491637023642, 57.5299628959222, 35.4243931073053, 38.3858021277704, 45.9060160845621, 45.5880654083465, 46.872841394771, 41.9127954550172, 40.2953871705296, 39.2134766212099, 41.4365302397403, 51.277552995909, 79.9794582620079, 77.9051139411665, 82.4559257711504, 89.5519191091931, 85.3416571939188, 82.390107793166, 86.9482937078062, 90.2512478803945, 93.9378508972261, 104.075472152244, 114.354832289326, 93.0168787876722, 104.148633325139, 25.9355690831737, 25.0134522316518, 23.980867699183, 28.020506467552, 27.4897630463662, 30.4383675184056, 33.5982316952082, 36.9592732888675, 42.7681664695131, 48.0583947791253, 49.0265445505002, 43.5326006451782, 47.6404394303252, 30.043921931244, 36.0247101570245, 32.7490333383822, 35.3299767816294, 36.2777941575217, 36.5857264653029, 35.4600862458745, 38.9942854848779, 43.6332857896204, 46.7774166520615, 56.2582682052931, 46.7447497538494, 45.719821647259, 48.8966176420388, 46.8618860908556, 51.4377739547977, 54.8016334271381, 59.7646362953014, 51.4018310923647, 51.0780341359982, 53.1491153902934, 60.2772643253235, 63.6830872879002, 72.865390240783, 55.4182616022717, 55.9889858083946), credit.gdp = c(12.1559474412172, 13.8731694622537, 14.7111330843286, 16.5861602106911, 19.2801590248722, 19.9773621242987, 21.935704704551, 19.7635783205068, 20.4844134528386, 22.6643360675293, 25.7871707259677, 28.9314710242801, 27.1935874525637, 9.3588471656594, 12.5620832397761, 13.971491324036, 11.8843912608955, 12.1495373048323, 12.493048761649, 13.1724893671741, 15.5440688136274, 11.0935881051932, 14.4884302260337, 15.8819996394551, 15.6580614285644, 15.2896953808711, 23.9634167841824, 26.5694419300027, 25.7583827680558, 25.2226866951229, 25.8546018348267, 25.1556752227903, 27.2875160327278, 26.2768754700489, 22.8883109960388, 23.0449642815856, 25.380611749054, 25.0216100008749, 27.2281230094577, 41.9922957395565, 45.524117380598, 48.5920037684968, 42.595142869912, 41.514712192781, 40.5810611288112, 40.6913982726517, 44.0348960227578, 46.4947439821053, 55.5544935434842, 60.6939535030437, 63.298478634885, 90.1261045952435, 56.4087879274322, 56.4371131224897, 56.5017023177118, 56.8527117251502, 57.6954985007251, 70.6444058466662, 70.9078227589402, 72.8987930395477, 68.6878766043514, 71.7467361526219, 81.798055590861, 80.077012635807, 85.3551207721711, 7.10880229410367, 7.96064582503499, 9.07588654704307, 8.4205982311725, 4.42368375569741, 4.12578635126165, 4.56261391529402, 5.96273880301245, 6.88566905409057, 8.48420711776938, 9.11346313808723, 10.874779615102, 13.8296193206838, 2.72451562468195, 2.07182729985576, 2.10803360905412, 1.60393380038774, 2.00066380829, 2.86272274651729, 3.47359161882558, 3.34569629280925, 3.38374842848296, 4.32704418518391, 5.57482151429081, 8.2244969408349, 7.82381885435775, 59.9114127479609, 59.4689151154844, 59.9890124450877, 61.5108846644512, 62.3029658312412, 60.7479737542157, 58.9506290134042, 58.291705476344, 57.3279120235501, 57.8508167391409, 59.8904950079431, 62.2474436408009, 69.1119238119405, 2.94098178373874, 3.19184158182203, 3.11280258139082, 4.11428871406693, 5.22225830518537, 6.19017500752826, 7.10723140142027, 7.82538446272157, 9.7900200282604, 11.4689486744127, 11.9110255359744, 11.2673883569513, 11.7182622748719, 5.61773653446055, 6.35503596999033, 6.23417489329316, 7.10581101549379, 7.94713986633, 8.40008730819313, 8.05769990358755, 8.61580595213707, 10.1087586420267, 10.2315288620039, 13.9010555944997, 11.3939651767063, 13.3412974682694, 115.167927074881, 131.048239419325, 130.312222875041, 138.792502825903, 110.718367670577, 115.862201711497, 126.932346081347, 138.159429134112, 156.976212198837, 160.124784843962, 140.349876469094, 145.941155530687, 148.981377257943), tcom.expenditures = c(44.9909396841833, 39.554857245466, 13.9246560846561, 14.0737148399612, 6.76750216076059, 8.09974204643164, 32.9714655082644, 48.9177489177489, 139.940652818991, 121.831792162043, 122.222222222222, 83.1780022340517, 97.1278232845244, 17.3296791151366, 51.1834077635792, 39.8092327249022, 29.5183840297513, 46.4222660098522, 37.9005864537939, 39.4650789385549, 39.7348578174596, 46.4332628428242, 50.7346910753857, 48.9306601463602, 54.5890235230154, 65.474231692618, 23.7558126338013, 47.6844898914732, 88.5325225881043, 60.9741969457609, 56.7973380472081, 121.39797979798, 63.5798354333396, 76.276595616334, 86.9341070879351, 38.2148377048496, 38.8345708793487, 28.0003658339255, 22.3398064018053, 17.0212765957447, 27.3486184597296, 50.5983455144165, 54.2341871406168, 24.780316344464, 14.5593869731801, 12.9913871914546, 17.0377741841854, 19.3510990667026, 17.8142852313829, 21.7629505634585, 19.4388572502947, 16.9884256525352, 35.8793565311533, 40.8036589349886, 37.6368421052632, 46, 36.0179885527392, 20.7171314741036, 15.2497710665496, 12.8524350054925, 139.611696300585, 239.343738482923, 332.593273232957, 200.186131773862, 198.030510839216, 48.1660617171227, 50.1062731905492, 43.9127575047584, 43.6412224204366, 47.154925974151, 60.0567681109346, 60.9400094348027, 49.0557583779906, 53.2606139801461, 46.007802503933, 46.2468902291235, 45.2795519534293, 44.8134683867311, 38.0493549409312, 36.4940963229338, 44.1956216488544, 47.5805569117872, 48.0306309209656, 44.4594641819265, 36.1292386128148, 36.6057317747686, 35.5863179507164, 32.9036967946372, 31.6234246781379, 30.7571688947997, 35.3607106156828, 44.6, 27.5926666666667, 39.7666666666667, 40.9375668449198, 52.8315085158151, 51.9364448857994, 36.1369590748939, 21.7050194567775, 23.1752181500873, 15.5406050955414, 16.0651769087523, 15.7435135035524, 22.9495551600144, 202.152655897418, 123.016311254854, 12.5584439872826, 4.31894034754177, 32.5379729586361, 36.5829805779089, 39.5767836903267, 51.103487719556, 77.6305326891461, 89.511782730033, 87.6889453349354, 87.8851766652546, 85.1123548450702, 29.9731182795699, 63.3780584056827, 40.3521057480799, 26.2316949568384, 39.0556537062055, 32.2887634915962, 35.5603979114751, 23.4316517374623, 34.9136873483129, 38.9161470932355, 63.1436512641694, 46.7493999586681, 15.8980094866733, 49.5224619738238, 30.2791277575634, 25.5268876184047, 22.490441562336, 12.2227289013387, 9.76977392749065, 12.5397345787871, 12.5958315477538, 13.3068636681656, 13.0779081373232, 14.035710267351, 12.0871502847239, 10.7333516120188 ), fem.mortality = c(475.186, 491.194, 507.203, 523.211, 539.22, 509.391, 479.562, 449.733, 419.904, 390.075, 360.343, 330.611, 300.88, 278.695, 279.318, 279.94, 280.563, 281.185, 274.368, 267.551, 260.733, 253.916, 247.098, 244.879, 242.659, 240.439, 428.528, 434.616, 440.704, 446.792, 452.88, 426.092, 399.304, 372.515, 345.727, 318.939, 294.401, 269.863, 245.325, 142.93, 137.941, 132.952, 127.963, 122.973, 115.272, 107.571, 99.87, 92.168, 84.467, 81.583, 78.7, 75.816, 115.727, 114.941, 114.155, 113.369, 112.583, 110.82, 109.057, 107.294, 105.531, 103.768, 102.372, 100.975, 99.578, 491.497, 504.45, 517.402, 530.354, 543.307, 522.032, 500.757, 479.482, 458.208, 436.933, 403.293, 369.652, 336.012, 533.122, 522.485, 511.849, 501.212, 490.575, 480.462, 470.348, 460.234, 450.121, 440.007, 433.448, 426.889, 420.331, 87.15, 85.409, 83.668, 81.927, 80.185, 79.151, 78.117, 77.083, 76.049, 75.015, 74.819, 74.624, 74.428, 411.679, 412.226, 412.773, 413.32, 413.867, 398.814, 383.761, 368.708, 353.655, 338.602, 320.53, 302.457, 284.385, 503.374, 491.502, 479.63, 467.759, 455.887, 438.342, 420.798, 403.253, 385.708, 368.163, 351.349, 334.534, 317.72, 318.746, 346.783, 374.819, 402.855, 430.891, 438.722, 446.554, 454.385, 462.216, 470.048, 443.013, 415.978, 388.943), gov.spending = c(30.0691562932227, 27.4109473451781, 24.9027290058887, 23.4866322167786, 22.3791259879126, 22.0087160576493, 20.5323439366629, 19.4007450572658, 17.0378523144023, 17.5947805481447, 20.3512591725774, 21.0895434476663, 19.7565055668383, 10.3241616558742, 10.8433463882059, 10.1716158733082, 9.72236391765846, 9.87277025091073, 11.5332032401368, 12.1728118810468, 15.3081652628808, 8.87072220384494, 8.52494036113545, 8.73165976762738, 7.57424395572255, 7.06949942103097, 16.2499609195116, 15.7532966549933, 15.0542922556179, 15.9729117514735, 17.0779999092115, 18.1313185754854, 17.860065964127, 17.3802115523848, 14.3469988040006, 14.6296114670377, 15.6739794237589, 15.2144716882565, 14.1690291496481, 15.909932567873, 17.1164300051583, 17.6041341832193, 17.8871729081631, 17.6402498205155, 17.4233499982418, 17.9050829757389, 18.5470095999218, 17.8416192248279, 17.5145553101787, 16.7672070508913, 18.2398264222434, 17.9478323375273, 13.7475945571122, 14.2303708019475, 14.2517815909722, 13.9259423965107, 14.160138296696, 14.0794924827347, 14.2020517229511, 14.522658939736, 14.1239287477005, 12.4355925097272, 12.464556347492, 13.9222500993981, 13.8184876460025, 14.6836338748822, 13.4459910050491, 14.5778385471568, 15.8088305369244, 10.507191590428, 9.39791339101711, 9.43958737759919, 10.787801754538, 11.3941159486131, 10.9939564834833, 13.2280032712649, 15.9463069217763, 14.2314104667119, 8.9311888689247, 11.465143776952, 14.3331038132408, 13.0207209895975, 13.9241039189649, 11.826593083486, 10.3634307955356, 9.88617095832977, 10.0989496155412, 8.64646187591551, 9.65365486831351, 10.5131302216528, 10.3997147358601, 16.4285570436008, 16.2747374686763, 16.6712533083276, 16.5715905690391, 17.2266225753311, 17.2011093112602, 16.9223401461433, 16.9193475197631, 16.708663241378, 16.5074774153175, 16.1341685393665, 16.6311616777897, 16.6170535013361, 8.22893960121832, 7.83559002503336, 7.85118007488108, 8.00368234648943, 8.86438840773774, 10.3783153870602, 11.4759029364499, 11.9180432372987, 11.8898254476192, 13.1092645429996, 11.3175962184067, 12.3330567444363, 10.3622039009865, 12.8669462699382, 12.8642588762285, 14.5043243985272, 15.5818448611249, 16.7924696963901, 15.745053345914, 13.8873022740436, 14.4927633930359, 14.1023117957031, 12.8930348105166, 11.2108868131478, 9.22514084936743, 9.59420700442812, 18.9117687991198, 18.5808257053284, 18.3869372434811, 18.5340641441331, 18.8051903242104, 19.0578880435914, 19.1575642530287, 19.4781894691122, 18.1535283244536, 17.8140148717565, 18.6579250952803, 19.864480154342, 20.2296379063367)), row.names = c(1504L, 1505L, 1506L, 1507L, 1508L, 1509L, 1510L, 1511L, 1512L, 1513L, 1514L, 1515L, 1516L, 3715L, 3716L, 3717L, 3718L, 3719L, 3720L, 3721L, 3722L, 3723L, 3724L, 3725L, 3726L, 3727L, 5289L, 5290L, 5291L, 5292L, 5293L, 5294L, 5295L, 5296L, 5297L, 5298L, 5299L, 5300L, 5301L, 6534L, 6535L, 6536L, 6537L, 6538L, 6539L, 6540L, 6541L, 6542L, 6543L, 6544L, 6545L, 6546L, 7329L, 7330L, 7331L, 7332L, 7333L, 7334L, 7335L, 7336L, 7337L, 7338L, 7339L, 7340L, 7341L, 7431L, 7432L, 7433L, 7434L, 7435L, 7436L, 7437L, 7438L, 7439L, 7440L, 7441L, 7442L, 7443L, 9597L, 9598L, 9599L, 9600L, 9601L, 9602L, 9603L, 9604L, 9605L, 9606L, 9607L, 9608L, 9609L, 10577L, 10578L, 10579L, 10580L, 10581L, 10582L, 10583L, 10584L, 10585L, 10586L, 10587L, 10588L, 10589L, 10886L, 10887L, 10888L, 10889L, 10890L, 10891L, 10892L, 10893L, 10894L, 10895L, 10896L, 10897L, 10898L, 10988L, 10989L, 10990L, 10991L, 10992L, 10993L, 10994L, 10995L, 10996L, 10997L, 10998L, 10999L, 11000L, 11699L, 11700L, 11701L, 11702L, 11703L, 11704L, 11705L, 11706L, 11707L, 11708L, 11709L, 11710L, 11711L), class = "data.frame")
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xuyiqing/gsynth/issues/35?email_source=notifications&email_token=AB2PKGGQXY243L7IUJ33UPDQTPLXPA5CNFSM4JMYZP32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HY66REA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2PKGELIC4WG3HM3RVR36TQTPLXPANCNFSM4JMYZP3Q .
-- Yiqing Xu
Assistant Professor Department of Political Science Stanford University http://yiqingxu.org/
Hi,
thank you for implementing this valuable method in R.
However, I'm facing the issue that attempts to adjust the
nboot
often fail with an error. Please see MCVE below. It would be great if you could take a look at it.Cheers
MCVE
Sample data