MedCalc

# 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.613636 0.425414 20 0.775588 0.58011 20 0.709063 0.516854 20 0.885233 0.714286 20 0.803477 0.619565 20 0.815849 0.610811 20 0.796198 0.595506

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.778947 Kendall's Tau 0.557895

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.