Skip to content

Commit 5617af8

Browse files
authored
Merge pull request #119 from LI-Yixuan/delta-delta
Delta delta
2 parents 6b215c2 + 49fce3e commit 5617af8

44 files changed

Lines changed: 2346 additions & 180 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,7 @@ fontList-v300.json
122122
# tex folders
123123
tex.cache/
124124
.Rproj.user
125+
testtt.py
126+
real.py
127+
0to2_beforeduringafter.csv
128+

dabest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
from ._stats_tools import effsize as effsize
2424
from ._classes import TwoGroupsEffectSize, PermutationTest
2525

26-
__version__ = "0.3.1"
26+
__version__ = "0.3.9999"

dabest/_api.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
# Email : joseshowh@gmail.com
55

66

7-
def load(data, idx, x=None, y=None, paired=False, id_col=None,
8-
ci=95, resamples=5000, random_seed=12345):
7+
def load(data, idx=None, x=None, y=None, paired=None, id_col=None,
8+
ci=95, resamples=5000, random_seed=12345, proportional=False,
9+
delta2 = False, experiment = None, experiment_label = None,
10+
x1_level = None):
911
'''
1012
Loads data in preparation for estimation statistics.
1113
@@ -18,10 +20,14 @@ def load(data, idx, x=None, y=None, paired=False, id_col=None,
1820
List of column names (if 'x' is not supplied) or of category names
1921
(if 'x' is supplied). This can be expressed as a tuple of tuples,
2022
with each individual tuple producing its own contrast plot
21-
x : string, default None
23+
x : string or list, default None
24+
Column name(s) of the independent variable. This can be expressed as
25+
a list of 2 elements if and only if 'delta2' is True; otherwise it
26+
can only be a string.
2227
y : string, default None
2328
Column names for data to be plotted on the x-axis and y-axis.
24-
paired : boolean, default False.
29+
paired : string, default None
30+
The type of the experiment under which the data are obtained
2531
id_col : default None.
2632
Required if `paired` is True.
2733
ci : integer, default 95
@@ -34,6 +40,21 @@ def load(data, idx, x=None, y=None, paired=False, id_col=None,
3440
This integer is used to seed the random number generator during
3541
bootstrap resampling, ensuring that the confidence intervals
3642
reported are replicable.
43+
proportional : boolean, default False.
44+
TO INCLUDE MORE DESCRIPTION ABOUT DATA FORMAT
45+
delta2 : boolean, default False
46+
Indicator of delta-delta experiment
47+
experiment : String, default None
48+
The name of the column of the dataframe which contains the label of
49+
experiments
50+
experiment_lab : list, default None
51+
A list of String to specify the order of subplots for delta-delta plots.
52+
This can be expressed as a list of 2 elements if and only if 'delta2'
53+
is True; otherwise it can only be a string.
54+
x1_level : list, default None
55+
A list of String to specify the order of subplots for delta-delta plots.
56+
This can be expressed as a list of 2 elements if and only if 'delta2'
57+
is True; otherwise it can only be a string.
3758
3859
Returns
3960
-------
@@ -62,4 +83,4 @@ def load(data, idx, x=None, y=None, paired=False, id_col=None,
6283
'''
6384
from ._classes import Dabest
6485

65-
return Dabest(data, idx, x, y, paired, id_col, ci, resamples, random_seed)
86+
return Dabest(data, idx, x, y, paired, id_col, ci, resamples, random_seed, proportional, delta2, experiment, experiment_label, x1_level)

dabest/_bootstrap_tools.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,92 +9,70 @@
99

1010
class 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

Comments
 (0)