99
1010class bootstrap :
1111 '''Computes the summary statistic and a bootstrapped confidence interval.
12-
1312 Keywords:
1413 x1, x2: array-like
1514 The data in a one-dimensional array form. Only x1 is required.
1615 If x2 is given, the bootstrapped summary difference between
1716 the two groups (x2-x1) is computed.
1817 NaNs are automatically discarded.
19-
2018 paired: boolean, default False
2119 Whether or not x1 and x2 are paired samples.
22-
2320 statfunction: callable, default np.mean
2421 The summary statistic called on data.
25-
2622 smoothboot: boolean, default False
2723 Taken from seaborn.algorithms.bootstrap.
2824 If True, performs a smoothed bootstrap (draws samples from a kernel
2925 destiny estimate).
30-
3126 alpha: float, default 0.05
3227 Denotes the likelihood that the confidence interval produced
3328 does not include the true summary statistic. When alpha = 0.05,
3429 a 95% confidence interval is produced.
35-
3630 reps: int, default 5000
3731 Number of bootstrap iterations to perform.
38-
3932 Returns:
4033 An `bootstrap` object reporting the summary statistics, percentile CIs,
4134 bias-corrected and accelerated (BCa) CIs, and the settings used.
42-
4335 summary: float
4436 The summary statistic.
45-
4637 is_difference: boolean
4738 Whether or not the summary is the difference between two groups.
4839 If False, only x1 was supplied.
49-
5040 is_paired: boolean
5141 Whether or not the difference reported is between 2 paired groups.
52-
5342 statistic: callable
5443 The function used to compute the summary.
55-
5644 reps: int
5745 The number of bootstrap iterations performed.
58-
5946 stat_array: array.
6047 A sorted array of values obtained by bootstrapping the input arrays.
61-
6248 ci: float
6349 The size of the confidence interval reported (in percentage).
64-
6550 pct_ci_low, pct_ci_high: floats
6651 The upper and lower bounds of the confidence interval as computed
6752 by taking the percentage bounds.
68-
6953 pct_low_high_indices: array
7054 An array with the indices in `stat_array` corresponding to the
7155 percentage confidence interval bounds.
72-
7356 bca_ci_low, bca_ci_high: floats
7457 The upper and lower bounds of the bias-corrected and accelerated
7558 (BCa) confidence interval. See Efron 1977.
76-
7759 bca_low_high_indices: array
7860 An array with the indices in `stat_array` corresponding to the BCa
7961 confidence interval bounds.
80-
8162 pvalue_1samp_ttest: float
8263 P-value obtained from scipy.stats.ttest_1samp. If 2 arrays were
8364 passed (x1 and x2), returns 'NIL'.
8465 See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.ttest_1samp.html
85-
8666 pvalue_2samp_ind_ttest: float
8767 P-value obtained from scipy.stats.ttest_ind.
8868 If a single array was given (x1 only), or if `paired` is True,
8969 returns 'NIL'.
9070 See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.ttest_ind.html
91-
9271 pvalue_2samp_related_ttest: float
9372 P-value obtained from scipy.stats.ttest_rel.
9473 If a single array was given (x1 only), or if `paired` is False,
9574 returns 'NIL'.
9675 See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.ttest_rel.html
97-
9876 pvalue_wilcoxon: float
9977 P-value obtained from scipy.stats.wilcoxon.
10078 If a single array was given (x1 only), or if `paired` is False,
@@ -103,14 +81,12 @@ class bootstrap:
10381 the null hypothesis that the related samples x1 and x2 are from
10482 the same distribution.
10583 See https://docs.scipy.org/doc/scipy-1.0.0/reference/scipy.stats.wilcoxon.html
106-
10784 pvalue_mann_whitney: float
10885 Two-sided p-value obtained from scipy.stats.mannwhitneyu.
10986 If a single array was given (x1 only), returns 'NIL'.
11087 The Mann-Whitney U-test is a nonparametric unpaired test of the null
11188 hypothesis that x1 and x2 are from the same distribution.
11289 See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.mannwhitneyu.html
113-
11490 '''
11591 def __init__ (self , x1 , x2 = None ,
11692 paired = False ,
@@ -284,7 +260,6 @@ def jackknife_indexes(data):
284260 From the scikits.bootstrap package.
285261 Given an array, returns a list of arrays where each array is a set of
286262 jackknife indexes.
287-
288263 For a given set of data Y, the jackknife sample J[i] is defined as the
289264 data set Y with the ith data point deleted.
290265 """
@@ -332,4 +307,4 @@ def bca(data, alphas, statarray, statfunction, ostat, reps):
332307 nvals = np .round ((reps - 1 )* avals )
333308 nvals = np .nan_to_num (nvals ).astype ('int' )
334309
335- return nvals
310+ return nvals
0 commit comments