Skip to content

Commit 53446b7

Browse files
committed
Remove is_paired/paired for repeated measures
1. slopeplot corrected 2.paired is removed
1 parent 6b215c2 commit 53446b7

8 files changed

Lines changed: 255 additions & 160 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,4 @@ fontList-v300.json
122122
# tex folders
123123
tex.cache/
124124
.Rproj.user
125+
testtt.py

dabest/_api.py

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

66

7-
def load(data, idx, x=None, y=None, paired=False, id_col=None,
7+
def load(data, idx, x=None, y=None, repeated_measures = None, id_col=None,
88
ci=95, resamples=5000, random_seed=12345):
99
'''
1010
Loads data in preparation for estimation statistics.
@@ -21,7 +21,8 @@ def load(data, idx, x=None, y=None, paired=False, id_col=None,
2121
x : string, default None
2222
y : string, default None
2323
Column names for data to be plotted on the x-axis and y-axis.
24-
paired : boolean, default False.
24+
repeated_measures : string, default None
25+
The type of the experiment under which the data are obtained
2526
id_col : default None.
2627
Required if `paired` is True.
2728
ci : integer, default 95
@@ -62,4 +63,4 @@ def load(data, idx, x=None, y=None, paired=False, id_col=None,
6263
'''
6364
from ._classes import Dabest
6465

65-
return Dabest(data, idx, x, y, paired, id_col, ci, resamples, random_seed)
66+
return Dabest(data, idx, x, y, repeated_measures, id_col, ci, resamples, random_seed)

dabest/_bootstrap_tools.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class bootstrap:
1717
the two groups (x2-x1) is computed.
1818
NaNs are automatically discarded.
1919
20-
paired: boolean, default False
21-
Whether or not x1 and x2 are paired samples.
20+
repeated_measures: string, default None
21+
The type of the experiment design.
2222
2323
statfunction: callable, default np.mean
2424
The summary statistic called on data.
@@ -47,8 +47,8 @@ class bootstrap:
4747
Whether or not the summary is the difference between two groups.
4848
If False, only x1 was supplied.
4949
50-
is_paired: boolean
51-
Whether or not the difference reported is between 2 paired groups.
50+
repeated_measures: string
51+
The type of experiment design.
5252
5353
statistic: callable
5454
The function used to compute the summary.
@@ -85,19 +85,19 @@ class bootstrap:
8585
8686
pvalue_2samp_ind_ttest: float
8787
P-value obtained from scipy.stats.ttest_ind.
88-
If a single array was given (x1 only), or if `paired` is True,
88+
If a single array was given (x1 only), or if `repeated_measures` is not None,
8989
returns 'NIL'.
9090
See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.ttest_ind.html
9191
9292
pvalue_2samp_related_ttest: float
9393
P-value obtained from scipy.stats.ttest_rel.
94-
If a single array was given (x1 only), or if `paired` is False,
94+
If a single array was given (x1 only), or if `repeated_measures` is None,
9595
returns 'NIL'.
9696
See https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.stats.ttest_rel.html
9797
9898
pvalue_wilcoxon: float
9999
P-value obtained from scipy.stats.wilcoxon.
100-
If a single array was given (x1 only), or if `paired` is False,
100+
If a single array was given (x1 only), or if `repeated_measures` is None,
101101
returns 'NIL'.
102102
The Wilcoxons signed-rank test is a nonparametric paired test of
103103
the null hypothesis that the related samples x1 and x2 are from
@@ -113,7 +113,7 @@ class bootstrap:
113113
114114
'''
115115
def __init__(self, x1, x2=None,
116-
paired=False,
116+
repeated_measures=None,
117117
statfunction=None,
118118
smoothboot=False,
119119
alpha_level=0.05,
@@ -146,7 +146,7 @@ def __init__(self, x1, x2=None,
146146
'n_boot': reps,
147147
'smooth': smoothboot}
148148

149-
if paired:
149+
if repeated_measures:
150150
# check x2 is not None:
151151
if x2 is None:
152152
raise ValueError('Please specify x2.')
@@ -155,17 +155,17 @@ def __init__(self, x1, x2=None,
155155
if len(x1) != len(x2):
156156
raise ValueError('x1 and x2 are not the same length.')
157157

158-
if (x2 is None) or (paired is True) :
158+
if (x2 is None) or (repeated_measures) :
159159

160160
if x2 is None:
161161
tx = x1
162-
paired = False
162+
repeated_measures = None
163163
ttest_single = ttest_1samp(x1, 0)[1]
164164
ttest_2_ind = 'NIL'
165165
ttest_2_paired = 'NIL'
166166
wilcoxonresult = 'NIL'
167167

168-
elif paired is True:
168+
elif repeated_measures:
169169
diff = True
170170
tx = x2 - x1
171171
ttest_single = 'NIL'
@@ -188,7 +188,7 @@ def __init__(self, x1, x2=None,
188188
pct_low_high = np.nan_to_num(pct_low_high).astype('int')
189189

190190

191-
elif x2 is not None and paired is False:
191+
elif x2 is not None and repeated_measures is None:
192192
diff = True
193193
x2 = pd.Series(x2).dropna()
194194
# Generate statarrays for both arrays.
@@ -228,7 +228,7 @@ def __init__(self, x1, x2=None,
228228
" results may be unstable.")
229229

230230
self.summary = summ_stat
231-
self.is_paired = paired
231+
self.repeated_measures = repeated_measures
232232
self.is_difference = diff
233233
self.statistic = str(statfunction)
234234
self.n_reps = reps
@@ -252,7 +252,7 @@ def __init__(self, x1, x2=None,
252252

253253
self.results = {'stat_summary': self.summary,
254254
'is_difference': diff,
255-
'is_paired': paired,
255+
'repeated_measures': repeated_measures,
256256
'bca_ci_low': self.bca_ci_low,
257257
'bca_ci_high': self.bca_ci_high,
258258
'ci': self.ci
@@ -270,7 +270,7 @@ def __repr__(self):
270270

271271
diff_types = {True: 'paired', False: 'unpaired'}
272272
if self.is_difference:
273-
a = 'The {} {} difference is {}.'.format(diff_types[self.is_paired],
273+
a = 'The {} {} difference is {}.'.format(diff_types[self.repeated_measures is not None],
274274
stat, self.summary)
275275
else:
276276
a = 'The {} is {}.'.format(stat, self.summary)

0 commit comments

Comments
 (0)