Skip to main content
MedCalc
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
working
Show menu Show menu

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:

200.6136363640.425414365
200.7755875660.580110497
200.7090632140.516853933
200.8852333590.714285714
200.8034769460.619565217
200.8158490570.610810811
200.7961977190.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 size20
Spearman's rho0.778947368
Kendall's Tau0.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.

See also

External links