A class to compute and store the results of bootstrapped mean differences between two groups.
Compute the effect size between two groups.
Type
Default
Details
control
array-like
test
array-like
These should be numerical iterables.
effect_size
string.
Any one of the following are accepted inputs: ‘mean_diff’, ‘median_diff’, ‘cohens_d’, ‘hedges_g’, or ‘cliffs_delta’
proportional
bool
False
is_paired
NoneType
None
ci
int
95
The confidence interval width. The default of 95 produces 95% confidence intervals.
resamples
int
5000
The number of bootstrap resamples to be taken for the calculation of the confidence interval limits.
permutation_count
int
5000
The number of permutations (reshuffles) to perform for the computation of the permutation p-value
random_seed
int
12345
random_seed is used to seed the random number generator during bootstrap resampling. This ensures that the confidence intervals reported are replicable.
Returns
py:class:TwoGroupEffectSize object:
difference : float The effect size of the difference between the control and the test. effect_size : string The type of effect size reported. is_paired : string The type of repeated-measures experiment. ci : float Returns the width of the confidence interval, in percent. alpha : float Returns the significance level of the statistical test as a float between 0 and 1. resamples : int The number of resamples performed during the bootstrap procedure. bootstraps : numpy ndarray The generated bootstraps of the effect size. random_seed : int The number used to initialise the numpy random seed generator, ie.seed_value from numpy.random.seed(seed_value) is returned. bca_low, bca_high : float The bias-corrected and accelerated confidence interval lower limit and upper limits, respectively. pct_low, pct_high : float The percentile confidence interval lower limit and upper limits, respectively.
The unpaired mean difference is -0.253 [95%CI -0.78, 0.25].
The p-value of the two-sided permutation t-test is 0.348, calculated for legacy purposes only.
5000 bootstrap samples were taken; the confidence interval is bias-corrected and accelerated.
Any p-value reported is the probability of observing theeffect size (or greater),
assuming the null hypothesis ofzero difference is true.
For each p-value, 5000 reshuffles of the control and test labels were performed.
Any one of the following are accepted inputs: ‘mean_diff’, ‘median_diff’, ‘cohens_d’, ‘hedges_g’, or ‘cliffs_delta’
is_paired
str
None
permutation_count
int
5000
The number of permutations (reshuffles) to perform.
random_seed
int
12345
random_seed is used to seed the random number generator during bootstrap resampling. This ensures that the generated permutations are replicable.
kwargs
Returns
py:class:PermutationTest object:
difference:float The effect size of the difference between the control and the test. effect_size:string The type of effect size reported.
Notes:
The basic concept of permutation tests is the same as that behind bootstrapping. In an “exact” permutation test, all possible resuffles of the control and test labels are performed, and the proportion of effect sizes that equal or exceed the observed effect size is computed. This is the probability, under the null hypothesis of zero difference between test and control groups, of observing the effect size: the p-value of the Student’s t-test.
Exact permutation tests are impractical: computing the effect sizes for all reshuffles quickly exceeds trivial computational loads. A control group and a test group both with 10 observations each would have a total of \(20!\) or \(2.43 \times {10}^{18}\) reshuffles. Therefore, in practice, “approximate” permutation tests are performed, where a sufficient number of reshuffles are performed (5,000 or 10,000), from which the p-value is computed.