Hello Statalist,
I am using Stata version 16.1 and I am currently in the beginning stages of developing a predictive model in which I am using the "mfp" command with the "select" option to develop models (where I can then save model performance statistics to be used later) within bootstrapping loops using the "bsample"command. For some reason I keep getting error messages pertaining to the estimation of the fractional polynomial at different iterations (stages) of my bootstrap. When I commented out the "bsample" my code runs smoothly (albeit 20 times on the same data/model). I used the auto.dta file originally in my do-file to ensure my code was correct before applying it to my real data and decided to only perform 20 iterations (to save time while testing, as opposed to 200 for my actual work).
The code I used for the bootstrap in Stata is as follows:
The error messages sometimes occur after 1 iteration right away or on other attempts I have made it through 16 iterations before the error message pops up. The error message from Stata is as follows:
I'm quite baffled as to why I am having this issue and why it is happening at different stages of my bootstraps. Any help would be greatly appreciated.
Connor
I am using Stata version 16.1 and I am currently in the beginning stages of developing a predictive model in which I am using the "mfp" command with the "select" option to develop models (where I can then save model performance statistics to be used later) within bootstrapping loops using the "bsample"command. For some reason I keep getting error messages pertaining to the estimation of the fractional polynomial at different iterations (stages) of my bootstrap. When I commented out the "bsample" my code runs smoothly (albeit 20 times on the same data/model). I used the auto.dta file originally in my do-file to ensure my code was correct before applying it to my real data and decided to only perform 20 iterations (to save time while testing, as opposed to 200 for my actual work).
The code I used for the bootstrap in Stata is as follows:
Code:
clear local boots = 20 clear set obs `boots' quietly { forvalues i = 1(1)`boots' { if floor((`i'-1)/5) == (`i'-1)/5 { noisily display "working on `i' out of `boots' at $S_TIME" } /*I used the above small loop and display command to know where in my bootstrap I am*/ preserve sysuse auto.dta, clear bsample /*when I comment this out my code runs/outputs fine*/ mfp, select(0.156, mpg:1): logistic foreign price length mpg rep78 /*multiple rows of code follow where I produce and save my performance statistics*/ restore } }
Code:
failure encountered when estimating fractional polynomial model frac_154 logistic foreign mpg Irep7_1 Ipric_1 Ieng_1 if _000002 , degree(2) powers(-2,-1,-.5,0,.5,1,2,3) name(Impg_) invalid syntax
Connor
Comment