Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: bca' option in bootstrap causing Stata to crash?


From   <Edmond.Ng@lshtm.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: bca' option in bootstrap causing Stata to crash?
Date   Fri, 28 May 2010 13:49:43 +0100

Dear Statalisters, 
 
I am running some user-written code for something known as 2-stage bootstrap algorithm on simulated clustered data where individuals are nested within clusters. At first stage the code samples whole clusters (done by Stata command 'bootstrap') and samples individuals within the chosen clusters at the second stage (using a user-written code). I ask Stata to provide bias-corrected and accelerated (BCa) confidence interval for each simulation for assessing conf. interval coverage. 
 
However, Stata crashes on some of the simulated datasets. I have looked at the datasets that caused the crashes but could not find anything obviously odd. Of course, it is possible that some simulated datasets are peculiar enough to lead to invalid or inadmissible results that could have caused Stata to crash. 
 
Though I notice when I take the 'bca' option off from the boostrap command line (see below) Stata no longer crashes. 
 
> bootstrap r(ct) r(cco) r(et) r(eco) r(dc) r(de) r(inb), cl(cluster) ///
 strata(treat) reps(1000) bca nodots nowarn ///
 saving(bsampling, replace): ///
 bs_secondstage cost qaly treat
 
I have two questions: 
 
1) Are there any known bug related to the 'bca' option in current version of bootstrap? I am using Stata version 11. I found some correspondence on 'bca' related problems in the Statalist archives, for example, the one titled "problem with -bca- option with bootstrapping a user-written program", but it was dated year 2005. I presume those known bugs would have been fixed by now. 
 
2) My 2nd question is whether there is any clever trick to stop Stata from crashing on the problematic datasets (in a forvalues loop) , skip current one, and continue onto the next dataset. I have tried the 'capture' command hoping to prevent Stata from crashing but to no avail. It just kept closing after issuing the same uninformative warning message "Stata has encountered a problem and needs to close..."  Are you aware of other tricks like that of 'try()' in R ? 

Someone suggested to me to 'set trace on' to see where the crash occurs. Very useful suggestion. However, what was even stranger was then when I applied the same code (with same seed) on the same problematic datasets repeatedly Stata crashed at different points! 
 
Thank you for any suggestion/solution in advance. 
 
Best wishes,
 Edmond 
 
Health Services Research Unit, 
London School Hygiene & Tropical Medicine, 
London , UK 


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index