99
1010class bootstrap :
1111 '''Computes the summary statistic and a bootstrapped confidence interval.
12+
1213 Keywords:
1314 x1, x2: array-like
1415 The data in a one-dimensional array form. Only x1 is required.
1516 If x2 is given, the bootstrapped summary difference between
1617 the two groups (x2-x1) is computed.
1718 NaNs are automatically discarded.
19+
1820 paired: boolean, default False
1921 Whether or not x1 and x2 are paired samples.
22+
2023 statfunction: callable, default np.mean
2124 The summary statistic called on data.
25+
2226 smoothboot: boolean, default False
2327 Taken from seaborn.algorithms.bootstrap.
2428 If True, performs a smoothed bootstrap (draws samples from a kernel
2529 destiny estimate).
30+
2631 alpha: float, default 0.05
2732 Denotes the likelihood that the confidence interval produced
2833 does not include the true summary statistic. When alpha = 0.05,
2934 a 95% confidence interval is produced.
35+
3036 reps: int, default 5000
3137 Number of bootstrap iterations to perform.
38+
3239 Returns:
3340 An `bootstrap` object reporting the summary statistics, percentile CIs,
3441 bias-corrected and accelerated (BCa) CIs, and the settings used.
42+
3543 summary: float
3644 The summary statistic.
45+
3746 is_difference: boolean
3847 Whether or not the summary is the difference between two groups.
3948 If False, only x1 was supplied.
49+
4050 is_paired: boolean
4151 Whether or not the difference reported is between 2 paired groups.
52+
4253 statistic: callable
4354 The function used to compute the summary.
55+
4456 reps: int
4557 The number of bootstrap iterations performed.
58+
4659 stat_array: array.
4760 A sorted array of values obtained by bootstrapping the input arrays.
61+
4862 ci: float
4963 The size of the confidence interval reported (in percentage).
64+
5065 pct_ci_low, pct_ci_high: floats
5166 The upper and lower bounds of the confidence interval as computed
5267 by taking the percentage bounds.
68+
5369 pct_low_high_indices: array
5470 An array with the indices in `stat_array` corresponding to the
5571 percentage confidence interval bounds.
72+
5673 bca_ci_low, bca_ci_high: floats
5774 The upper and lower bounds of the bias-corrected and accelerated
5875 (BCa) confidence interval. See Efron 1977.
76+
5977 bca_low_high_indices: array
6078 An array with the indices in `stat_array` corresponding to the BCa
6179 confidence interval bounds.
80+
6281 pvalue_1samp_ttest: float
6382 P-value obtained from scipy.stats.ttest_1samp. If 2 arrays were
6483 passed (x1 and x2), returns 'NIL'.
6584 See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.ttest_1samp.html
85+
6686 pvalue_2samp_ind_ttest: float
6787 P-value obtained from scipy.stats.ttest_ind.
6888 If a single array was given (x1 only), or if `paired` is True,
6989 returns 'NIL'.
7090 See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.ttest_ind.html
91+
7192 pvalue_2samp_related_ttest: float
7293 P-value obtained from scipy.stats.ttest_rel.
7394 If a single array was given (x1 only), or if `paired` is False,
7495 returns 'NIL'.
7596 See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.ttest_rel.html
97+
7698 pvalue_wilcoxon: float
7799 P-value obtained from scipy.stats.wilcoxon.
78100 If a single array was given (x1 only), or if `paired` is False,
@@ -81,12 +103,14 @@ class bootstrap:
81103 the null hypothesis that the related samples x1 and x2 are from
82104 the same distribution.
83105 See https://docs.scipy.org/doc/scipy-1.0.0/reference/scipy.stats.wilcoxon.html
106+
84107 pvalue_mann_whitney: float
85108 Two-sided p-value obtained from scipy.stats.mannwhitneyu.
86109 If a single array was given (x1 only), returns 'NIL'.
87110 The Mann-Whitney U-test is a nonparametric unpaired test of the null
88111 hypothesis that x1 and x2 are from the same distribution.
89112 See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.mannwhitneyu.html
113+
90114 '''
91115 def __init__ (self , x1 , x2 = None ,
92116 paired = False ,
@@ -260,6 +284,7 @@ def jackknife_indexes(data):
260284 From the scikits.bootstrap package.
261285 Given an array, returns a list of arrays where each array is a set of
262286 jackknife indexes.
287+
263288 For a given set of data Y, the jackknife sample J[i] is defined as the
264289 data set Y with the ith data point deleted.
265290 """
@@ -307,4 +332,4 @@ def bca(data, alphas, statarray, statfunction, ostat, reps):
307332 nvals = np .round ((reps - 1 )* avals )
308333 nvals = np .nan_to_num (nvals ).astype ('int' )
309334
310- return nvals
335+ return nvals
0 commit comments