Scripts - Bootstrap
Bootstrap command
Bootstrap(procedure,loops,matrixname) creates a matrix containing the bootstrap sampling distribution of various parameters estimated in a statistical procedure.
You can use this matrix in for example the Statistical functions to calculate the median and percentiles using the Median and Percentile functions, or calculate the number of values above or below a particular value using the CountIf conditional count function.
The following statistical procedures are enabled for the Bootstrap command (more will follow in coming MedCalc updates):
- MEANS
- CORRELATION, RANKCORRELATION, PARTIALCORRELATION, REGRESSION
- ONESAMPLETTEST, TTESTPAIRED, TTEST, FTEST
- YUENWELCHTEST
- SIGNEDRANKSUMTEST, WILCOXON, MANNWHITNEY,
- RELATIVERISK, MCNEMAR
- BLANDALTMAN, PASSINGBABLOK, DEMING
- CVFROMDUPLICATES
- CONCORDANCE, KAPPA
Example
// set decimal symbol and list separator so that this example works on // systems that have different settings for decimal symbol and list separator $decimalsymbol="."; $listseparator=","; // the data clear data; <data> SHBG TESTO 24.7 448.5 38 855.5 51.1 622 22.6 302 20.7 338.5 67.2 667.5 62.5 584 24.8 495 32.4 484 27.4 494.5 39.8 533 43.3 687.5 36.8 632.5 44.4 524 33.6 494 26.9 474 53.9 604 26.6 436 42.5 689.5 30.3 431.5 </data> // parameters for the statistical procedure $VariableX="SHBG"; $VariableY="TESTO"; $Filter=""; $RankCoefficients=BOTH; // call the bootstrap function bootstrap(RANKCORRELATION,100,bsresults); // display the results matrix ?bsresults;
The bootstrap procedure creates a 3x100 matrix named bsresults with the results of 100 bootstrap iterations. Here are a few top rows for illustration:
20 | 0.613636364 | 0.425414365 |
20 | 0.775587566 | 0.580110497 |
20 | 0.709063214 | 0.516853933 |
20 | 0.885233359 | 0.714285714 |
20 | 0.803476946 | 0.619565217 |
20 | 0.815849057 | 0.610810811 |
20 | 0.796197719 | 0.595505618 |
When you run this example, these results will be different. That is the nature of the bootstrap method.
The columns in the matrix are anonymous. To find out what they represent, use the PROC procedure as follows (see PROC command):
PROC(RANKCORRELATION,procresults); ?procresults;
This procedures creates a table with name procresults:
Sample size | 20 |
Spearman's rho | 0.778947368 |
Kendall's Tau | 0.557894737 |
So the first column in the bsresults matrix created by the bootstrap procedure contains the sample size for each bootstrap sample, the 2nd column contains Spearman's rho and the 3rd column contains Kendall's Tau.
Notes
- During bootstrapping, subgroups are ignored.
- During execution, bootstrap procedures in the statistical procedure itself are disabled.
- When logarithmic transformation (or Box-Cox transformation) is applied, the reported results are not back-transformed to their original scale.