Announcement

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

  • bootstrap error message

    Hi everyone,

    I am using stcox to study the impact of election on the probability of reaching peaks or troughs in the US stock market. Due to the relatively small number of stock market cycles I have that makes inference based upon standard asymptotic suspect. Therefore I would like to use boot-strap techniques to generate the standard error. Following a similar study, I resample "clusters" of observations from the original data set choosing the set of observations corresponding to an entire market cycle as one "draw. Each resample therefore has the same number of market cycles as the original sample." The covariate used in my regression is a binary variable that represents the period within 24 months after election.

    My code is

    Code:
    stset time, fail(event) id(phaseid) 
     bootstrap _b[a24],  cluster(cycleid) idcluster(newcycleid): stcox a24 if phase==1 & pww2==1
    However, Stata generates following error message
    Code:
    Note: One or more parameters could not be estimated in 2 bootstrap replicates;       standard-error estimates include only complete replications.
    and my data set

    Code:
     
     input byte cycleid int(phaseid time) byte(a9 a12 a24 event a9_d a12_d a24_d a9_r a12_r a24_r pww1 pww2 phase _st _d) int(_t _t0) float newcycleid  1  101  23 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0  23   0  1  1  101  32 1 1 1 0 1 1 1 0 0 0 0 0 1 1 0  32  23  1  1  101  35 0 1 1 0 0 1 1 0 0 0 0 0 1 1 0  35  32  1  1  101  44 0 0 1 1 0 0 1 0 0 0 0 0 1 1 1  44  35  1  1  102   3 0 0 1 0 0 0 1 0 0 0 0 0 2 1 0   3   0  1  1  102   7 0 0 0 1 0 0 0 0 0 0 0 0 2 1 1   7   3  1  2  201  10 0 0 0 1 0 0 0 0 0 0 1 0 1 1 1  10   0  2  2  202  10 0 0 0 0 0 0 0 0 0 0 1 0 2 1 0  10   0  2  2  202  18 1 1 1 1 0 0 0 1 1 1 1 0 2 1 1  18  10  2  3  301   1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 0   1   0  3  3  301   4 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0   4   1  3  3  301  16 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0  16   4  3  3  301  32 0 0 0 1 0 0 0 0 0 0 1 0 1 1 1  32  16  3  3  302  14 0 0 0 1 0 0 0 0 0 0 1 0 2 1 1  14   0  3  4  401   4 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0   4   0  4  4  401  13 1 1 1 0 0 0 0 1 1 1 1 0 1 1 0  13   4  4  4  401  16 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0  16  13  4  4  401  27 0 0 1 1 0 0 0 0 0 1 1 0 1 1 1  27  16  4  4  402   1 0 0 1 0 0 0 0 0 0 1 1 0 2 1 0   1   0  4  4  402  13 0 0 0 1 0 0 0 0 0 0 1 0 2 1 1  13   1  4  5  501  12 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0  12   0  5  5  501  21 1 1 1 1 0 0 0 1 1 1 1 0 1 1 1  21  12  5  5  502   3 1 1 1 0 0 0 0 1 1 1 1 0 2 1 0   3   0  5  5  502  15 0 1 1 0 0 0 0 0 1 1 1 0 2 1 0  15   3  5  5  502  39 0 0 1 0 0 0 0 0 0 1 1 0 2 1 0  39  15  5  5  502  43 1 1 1 1 1 1 1 0 0 0 1 0 2 1 1  43  39  5
    I am seeking for help how to over come the problem. Any suggestion and advice is highly appreciated. Thank you

  • #2
    When you do bootstrap (regardless of what command you are bootstrapping) it can happen that some of the random samples are invalid inputs to the command. This might arise due to happening to get a sample where a regression variable is always missing value, or where two variables turn out to be colinear and one of them drops. Or in your case, perhaps none of the randomly selected clusters satisfied phase == 1 & pw2 == 1. When -bootstrap- encounters such samples, it just tells you about them and moves on.

    If you want to see specifically what the problem was, add the -noisily- option to your -bootstrap- prefix and whatever it is will show up as an error message with the -stcox-output. Most error messages from regression commands are pretty clear and specific about what the problem is.

    In any case, there is nothing you can do to avoid this. If you got a lot of replicates that could not be estimated, it would suggest that the approach is misguided and needs some rethinking. But with only a few (2 in your case) being problematic, it just means that you have a slightly smaller number of bootstrap samples in your analysis than you hoped. If you're not comfortable with that, specify a larger number of reps to allow for the inevitable failure of a small fraction of them.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      When you do bootstrap (regardless of what command you are bootstrapping) it can happen that some of the random samples are invalid inputs to the command. This might arise due to happening to get a sample where a regression variable is always missing value, or where two variables turn out to be colinear and one of them drops. Or in your case, perhaps none of the randomly selected clusters satisfied phase == 1 & pw2 == 1. When -bootstrap- encounters such samples, it just tells you about them and moves on.

      If you want to see specifically what the problem was, add the -noisily- option to your -bootstrap- prefix and whatever it is will show up as an error message with the -stcox-output. Most error messages from regression commands are pretty clear and specific about what the problem is.

      In any case, there is nothing you can do to avoid this. If you got a lot of replicates that could not be estimated, it would suggest that the approach is misguided and needs some rethinking. But with only a few (2 in your case) being problematic, it just means that you have a slightly smaller number of bootstrap samples in your analysis than you hoped. If you're not comfortable with that, specify a larger number of reps to allow for the inevitable failure of a small fraction of them.
      Dear Clyde, thank you so much for your quick and detailed reply

      Comment

      Working...
      X