Announcement

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

  • Bootstrap error with NON PANEL data

    Hi guys,

    I'm experiencing some trobles when running a bootstrap over a program. I got this double error message
    Code:
    repeated time values in sample an error occurred when bootstrap executed multi_mfi, posting missing values insufficient observations to compute bootstrap standard errors no results will be saved
    . I've googled the error and find that it is typical of panel data, but this is not my case. My dataset is not a panel dataset. The data is monthly from 2003m1 to 2021m12, I will drop the program here:
    Code:
    cap program drop multi_mfi
    program multi_mfi, rclass
        
        args X Y Z
        qui {
        sort Date
        tset Date, monthly
        forv h = 12/12 {
        * X cumulative
            newey c`X'_`h' lc`X' target_factor ts_factor tf_ECB_totasset_IV_dem tsf_ECB_totasset_IV_dem  l.(lgdp hicp corpborr_cost LoantoDepSpread Capital LoanR Liquidity), lag(`h')
     
         cap drop `X'_ab `X'_ab2
        gen `X'_ab = e(b)[1,2]*-1+e(b)[1,4]*-1
        gen `X'_ab2 = e(b)[1,3]*-1+e(b)[1,5]*-1
        
        * Y cumulative
            newey c`Y'_`h' lc`Y' target_factor ts_factor tf_ECB_totasset_IV_dem tsf_ECB_totasset_IV_dem  l.(lgdp hicp corpborr_cost LoantoDepSpread Capital LoanR Liquidity), lag(`h')
     
        cap drop `Y'_ab `Y'_ab2
        gen `Y'_ab = e(b)[1,2]*-1+e(b)[1,4]*-1
        gen `Y'_ab2 = e(b)[1,3]*-1+e(b)[1,5]*-1
        
        * Z cumulative
            newey c`Z'_`h' lc`Z' target_factor ts_factor tf_ECB_totasset_IV_dem tsf_ECB_totasset_IV_dem  l.(lgdp hicp corpborr_cost LoantoDepSpread Capital LoanR Liquidity), lag(`h')
     
        cap drop `Z'_ab `Z'_ab2
        gen `Z'_ab = e(b)[1,2]*-1+e(b)[1,4]*-1
        gen `Z'_ab2 = e(b)[1,3]*-1+e(b)[1,5]*-1
        
        *** ECB tot asset
        cap drop ECB_totasset_`h'
        gen ECB_totasset_`h' = f`h'.ECB_totasset
        
        newey ECB_totasset_`h' target_factor ts_factor l.(lgdp hicp crisis), lag(`h')
            
            * conventional
        cap drop ECB_totasset_b ECB_totasset_b2
        gen ECB_totasset_b = e(b)[1,2]*-1
        gen ECB_totasset_b2 = e(b)[1,3]*-1
        }
        
        * coefficients conventional shock
        tempname MFI_loan_re_ab_conv
        gen `MFI_loan_re_ab_conv'=`X'_ab+`Y'_ab 
        * conventional multiplier
        return scalar  MFI_multi_re_conv=`MFI_loan_re_ab_conv'/ECB_totasset_b 
        return scalar MFI_multi_fin_conv=`Z'_ab/ECB_totasset_b 
        * coefficient unconventional shock
        tempname MFI_loan_re_ab_unconv
        gen `MFI_loan_re_ab_unconv'=`X'_ab2+`Y'_ab2     
        * unconventional multiplier
        return scalar MFI_multi_re_unconv=`MFI_loan_re_ab_unconv'/ECB_totasset_b2     
        return scalar  MFI_multi_fin_unconv=`Z'_ab2/ECB_totasset_b2
        }    
    end
    and this is the string for bootstrap

    Code:
    bootstrap r(MFI_multi_fin_unconv), reps(5) noisily:  multi_mfi MFI_loan_nfc MFI_loan_hh MFI_loan_nbfi
    the variables preceded by return scalar are those for which I want to bootstrap the error term.
    If you have any questions about the dataset I will be happy to reply.

    Many thanks in advance,

    Federica

  • #2
    I think they say it is common with panel data, and don't say anything about time-series data is just, at least to judge by frequency of mention hereon Statalist, panel data is so much more common. But I think it is not possible to apply bootstrapping to time-series data at all, or at least not if you need to use time-series operators like lags in the calculations.

    The reason is that bootstrapping involves sampling with replacement. This entails that in almost all bootstrap iterations, there will be some times that get represented more than once, leading to the impossibility of -tsset-ing the data. In fact, the problem is intractable for time series data as far as I can see. For panel data, you could sometimes work around this by bootstrapping full panels instead of individual observations (using the -cluster()- and -clusterid()- options). But with a single time series, I don't see any way out of the problem.

    Comment


    • #3
      Dear Clyde,
      thank you for your reply. At least now I know what is the issue and I can look for it.
      Many thanks.
      Federica

      Comment


      • #4
        in Efron, B and Tibshirani, RJ (1993), An Introduction to the Bootstrap, Chapman & Hall, the authors discuss two methods of bootstrapping time series: (1) fit a model and bootstrap the residuals; (2) "moving blocks" bootstrap (pp. 92-104) - I never use time series analytic methods and cannot provide further details but possibly others, or tech support, can help

        Comment

        Working...
        X