Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bootstrap standard error - VAR model

    Hi,

    I am trying to bootstrap standard error for the following VAR model:
    Code:
    // Set the number of bootstrap replications, e.g., 1000 for a thorough analysis
    set seed 123456 // Set a seed for reproducibility
    local numreps = 1000
    
    // Bootstrap the VAR model with the chosen number of lags, here assumed to be based on prior selection
    bs, reps(`numreps'): var yoy_ngdp yoy_unemp yoy_cpi yoy_int, lags(1/4) exog(aaci_combined_au) dfk small
    But I am getting the following error:
    Code:
    . // Bootstrap the VAR model with the chosen number of lags, here assumed to be based on prior selection
    . bs, reps(`numreps'): var yoy_ngdp yoy_unemp yoy_cpi yoy_int, lags(1/4) exog(aaci_combined_au) dfk small
    (running var on estimation sample)
    
    Bootstrap replications (1000)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    50
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   100
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   150
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   200
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   250
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   300
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   350
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   400
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   450
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   500
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   550
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   600
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   650
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   700
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   750
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   800
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   850
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   900
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   950
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  1000
    insufficient observations to compute bootstrap standard errors
    no results will be saved
    r(2000);
    I cannot increase the number of observations in my sample but I am willing to use whatever option bootstrap offers to attempt to get it to run. Would you be able to help me with that?

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(qdate yoy_ngdp yoy_unemp yoy_cpi yoy_int aaci_combined_au)
     84    .1271122025375666   -.04587305457845059    .09448818898639155    .28643852946768056 -.36
     85   .14292247884747322   -.11417189168872977    .08396946555473894    .18588177767809433  .03
     86    .1664775714641502   -.04786934240414553    .09022556393716652      .259419896920732 -.12
     87   .14697246250297602 -.0017045554886018222    .11029411798761823     .2836290780527677   .1
     88   .14841520983555534    .07610175352398363    .10791366897836752     .2862068971148293   .1
     89    .1497348939575831    .18833087161355144      .109154929550765     .2030895986000183 -.42
     90   .10397836452921494    .22136159380395437    .12413793088340497    .07447266442650191 -.63
     91   .09045411563919825     .4726505233415663    .11258278119958387   -.07558528428093636 -.47
     92   .07681362363357125     .5441401975820732    .11363636343773043   -.24013787816159748 -.27
     93   .04890039372647981     .5593660611895279    .11111111092120818   -.30987844530046227  .32
     94   .09601168987450581    .45398618620312803    .09202454016301287   -.27844551262019235 -.01
     95   .10841564264715209    .10360811133060843    .08630952371700973   -.26724553762662806  .22
     96   .14497556473771422  -.029640802187959836    .05830903807842769   -.10357862900615467 -.02
     97   .15657728281382854    -.1055894916588288   .040000000246114276   .003969238153319621 -.22
     98   .10673672653125243   -.14843044977368225    .03651685382468495   -.04525263796633738  -.1
     99   .09510179937794572   -.11021638326690542   .024657534293452077     .1445029620985836 -.22
    100   .09075088387770425   -.08922545135089699    .04407713499439758    .19342142221157688 -.23
    101    .1092721762986606   -.07400158087246089     .0659340659438179    .16308376575240913  .09
    102   .12177579365079372   -.07472216214081873    .07588075868106126    .40069787798798995 -.08
    103   .12512414838563535   -.08831315040066778    .08288770052860106     .5559390276100087 -.27
    104    .1047982130561107   -.07173066663208816    .09234828479925561    .26501766784452285  -.2
    105   .08240790133035891   -.07641221091942596    .08505154616073018   -.04036541300191199 -.01
    106   .07709800701178104   .008596162485175585    .08816120920259629   .044218393181603144 -.22
    107   .09177352412810502    .06278495056335132    .09629629629826564    -.1081330868961431 -.36
    108   .09852089445601453    .04306352193279417     .0942028985488399   -.08808193687150823 -.27
    109   .11978614417347422   .049327676200307646    .09263657957305416   -.05025459396717846  -.2
    110   .13494809688581322  -.029157823796887472    .08333333322948011    -.2598409544215028 -.23
    111   .13108173281511526  -.047881090140257876     .0720720720982897    -.2559585488613385  .04
    112    .1433770618842023    -.0918952068593929    .06843267107433171    -.3271390648003143 -.15
    113   .12908431356858974   -.06370692053375704    .07173913048923075   -.14289044265734274  .15
    114   .13282864820173623   -.13122023226947577    .07264957273216344    .07547676631748579  .16
    115   .13522868358018036   -.14799625780750614     .0756302522396064       .22116991581583  .46
    116   .12793948562783664   -.12259440896933127    .06818181823237945     .4977238244302651 -.11
    117   .14271033888094875   -.19521270449218286     .0750507098797839     .4509110681395403  .36
    118   .12422169004447481   -.13338324625769826    .07968127492176214     .3521478520599033 -.48
    119    .1082720222708291   -.13236133252737992    .07812500001642997    .24315693481823852 -.09
    120   .09629168633846952   -.05363662922147605    .08704061890233761 .00040526869300916424 -.12
    121   .07615021241846964     .0489915903713507    .07735849061893618   -.15257731942878683  .41
    122  .049744885020744034    .20108426900895426      .060885608896041   -.21924639837102955  .16
    123  .044157371689443004    .34252107343870386     .0688405796748075    -.3088073393928794 -.28
    124  .011412351962415634    .39837973413823113    .04804270471428973   -.29025724138337916  .37
    125 -.006675631543559657    .48770199797392655    .03327495629807409    -.2817960630391506 -.27
    126 .0069960478127688575    .37217399887231495   .031304347692236334    -.2890939198012775  .28
    127  .004257634626215978     .2946931558004373   .015254237314427987   -.33235996834819226 -.43
    128   .03286366803437324    .19388268644277362   .016977928742669457    -.3584474886130137 -.16
    129   .03588454286128706    .10645282604183759   .011864406759555024   -.37911918675057577 -.36
    130  .037894272197752654    .09766768878543841   .008431703320403328   -.42396006674743425  .02
    131   .04872669892299353    .08661992457273793  .0033388980294626336     -.298608349872708 -.15
    132  .051268597983735065    .04751615825571509   .011686143552514405   -.24021352314235822 -.16
    133   .05786643765285748    .01998859494592997    .01842546070872042    -.2242063492559524  -.4
    134   .04669933431952655   .006354395776418276    .02173913037215347    -.1513575967071057 -.25
    135   .04784953546340365  -.024735435836105824    .01830282869230171   -.18310657602040814  -.2
    136   .05080032797404721  -.039297709395872515   .014851485174023571   -.15163934421262526 -.05
    137   .05414515773218609   -.08749274896054615   .018092105155676164   -.04795396419743947  .15
    138   .08632553373788765   -.12962653947392955   .019639934627289746    .15316541864171773 -.22
    139  .057878620116950996   -.16774726031091491   .026143790856572702    .49618320628009593 -.11
    140    .0560710408467906     -.158582016167651   .037398373969220966     .6963423049689441 -.16
    141   .05600991118440324   -.15214847296579725    .04523424888812966     .5540631296544032 -.23
    142   .04760781890327204    -.1188577352882787    .05136436598109473    .33589138120803463  .37
    143   .07442659143873431   -.07054574201040642   .050955414025843915    .03710575129698013 -.08
    144   .06893948520258597  -.043214852444324436    .03761755486687002   -.08624898283507931  .05
    145   .07156446191895482    .00550299587377534   .030911901004493147   -.01944684529038221 -.22
    146   .05489797343971925   .028761765842313602   .021374045764382288   -.05479452050617739  .07
    147   .04916398395701571   .030522207800008472   .015151515196009102   -.13774597487199214  .09
    148   .04502663430979936   .027014775993800644   .013595166023586458   -.20837043632197816  .06
    149  .055030329930463084   .007213237073596668   .002998500790769576   -.23931247246537302 -.25
    150   .05656601330272526  -.027010274667525813  -.004484304994083699   -.30528284249649373 -.48
    151   .06935447601500111   -.07295929595900219   -.00298507466764264    -.2297717842723147 -.29
    152   .06725764242371945   -.09090802946780652 -.0014903128258202392    -.1608548932417967 -.33
    153   .04923607653959139   -.09038495131619428   .007473841495857059   -.11935110070216404  .33
    154  .060480501392757624   -.06777526153967384   .013513513537546151   .035666218104688285  .05
    155  .052300261840480866   -.07372613986982579   .014970059924156676  -.022895622828282836  .25
    156   .05439651862280814   -.09558167411202945   .011940298509861336    -.0368632707129265 -.08
    157   .05206460796172174   -.11153833792696566    .01038575665949204  -.042763157957713016  .21
    158   .05322914272581025   -.11552597269191445   .017777777702626674   -.03703703703703698 -.01
    159   .05209246557681402   -.09847773434864682     .0191740412421868    .13025499654512362  .04
    160   .07444320926131787  -.061858930860465566   .028023598726364174     .2073764787056367  .03
    161   .08116520148381534   -.08578190654272899    .03083700451324889     .2769759449484537  -.1
    162    .0875485532230611   -.12594167532936895    .06113537123858381     .2995951417004048 -.05
    163   .06303573945064311   -.07083551173744962    .05788712013043207    .15487804864909283 -.05
    164   .06122825169170021   -.04229269252364909   .060258249697394906  -.040922190088813926  .39
    165   .05878620527583567    .08380293135936712    .06125356116944092   -.20775026901010507 -.09
    166   .05487493765514562    .14072660166780038   .024691358068455127   -.24506749735202493  .24
    167   .07561514031942917    .13057264482414754    .03146374827913245    -.3194297781583648 -.09
    168    .0686105865939004    .04919509523164378    .02976995937522342   -.21694711549176993  .13
    169   .07641385892484576   -.06373207096616629    .02818791941652732  -.014945652308767321 -.02
    170   .06959050025814517   -.08336957284887525    .03212851406375039    .02200825295584541  .08
    171   .07212672010974397   -.11816306258065568   .029177718804481723    .13033359192161864   .1
    172   .06051930619350232   -.08816252535825309    .03285151119591556     .0982348427550448 -.03
    173  .052781887446065934   -.05396993514718784    .02610966065295428  -.017931034346064023  .17
    174  .062136070321630044   -.06126071548501888    .02594033716044275  -.027590847781129968  .14
    175   .07109798276654877   -.06929312403723131   .024484536141302637     .0809883321152376  .13
    176   .07984356613829857    -.0881718977553021   .020356234101572168    .16212438846960175  .17
    177    .0853564188692919   -.10113801849784365   .025445292558469834    .16151685378079228 -.11
    178   .07599060462401752   -.07074354541362715    .02275600509750375    .12941176462772241 -.12
    179   .06762450945165921   -.10034490473695068    .02515723264221914   .031746031809523956  .07
    180   .06658669364992886   -.07878125223092214   .023690772988986586   .013830427000230516  .02
    181   .07279231969971756   -.06862958340202652    .02481389585589211   .033252720800075686  .12
    182   .08278796393448462   -.09341285510239528     .0309023486028408    .03492647058823528  .42
    183   .08709619612488151  -.018174105475708302   .028220858887113787    .03938461532065318  .21
    end
    format %tq qdate

    As a side note, I am trying to reduce the confidence interval (increase statistical significance) that I then exhibit in a "irf graph". While I would really like to get some suggestions to get this bootstrap method to work, I would also welcome other alternative methods implemented in Stata, like Monte Carlo simulations that may also suit my purpose. Your help is greatly appreciated!


  • #2
    Is there someone who could help me there? Your help is greatly appreciated! Thanks!

    Comment


    • #3
      Originally posted by Francois Durant View Post
      I am trying to bootstrap standard error for the following VAR model: . . . I am willing to use whatever option bootstrap offers to attempt to get it to run. Would you be able to help me with that?
      According to the help file for var, "bayes, by, collect, fp, rolling, statsby, and xi are allowed; see prefix."

      bootstrap is not on that list.

      If you use bootstrap with its noisily option (and with only two replicates), then you can see that bootstrap isn't really set up for time series commands, which require a different approach for bootstrapping:
      repeated time values in sample
      an error occurred when bootstrap executed var, posting missing values

      Comment


      • #4
        This is not a trivial issue due to the nature of the panel data. Maybe this here contains some pointers: https://journals.sagepub.com/doi/pdf...867X1601600314
        Best wishes

        (Stata 16.1 MP)

        Comment

        Working...
        X