14
14
15
15
16
16
17
- @pytest .fixture
18
17
def create_dummy_dataset (seed = None , n = 30 , base_mean = 0 , expt_groups = 6 ,
19
18
scale_means = 2 , scale_std = 1.2 ):
20
19
"""
@@ -53,58 +52,39 @@ def create_dummy_dataset(seed=None, n=30, base_mean=0, expt_groups=6,
53
52
return random_seed , max_mean_diff , df
54
53
55
54
56
- @pytest .fixture
57
55
def is_difference (result ):
58
56
assert result .is_difference == True
59
57
60
-
61
- @pytest .fixture
62
58
def is_paired (result ):
63
59
assert result .is_paired == True
64
60
65
-
66
- @pytest .fixture
67
61
def check_pvalue_1samp (result ):
68
62
assert result .pvalue_1samp_ttest != 'NIL'
69
63
70
-
71
- @pytest .fixture
72
64
def check_pvalue_2samp_unpaired (result ):
73
65
assert result .pvalue_2samp_ind_ttest != 'NIL'
74
66
75
-
76
- @pytest .fixture
77
67
def check_pvalue_2samp_paired (result ):
78
68
assert result .pvalue_2samp_related_ttest != 'NIL'
79
69
80
-
81
- @pytest .fixture
82
70
def check_mann_whitney (result ):
83
71
"""Nonparametric unpaired"""
84
72
assert result .pvalue_mann_whitney != 'NIL'
85
73
assert result .pvalue_wilcoxon == 'NIL'
86
74
87
-
88
- @pytest .fixture
89
75
def check_wilcoxon (result ):
90
76
"""Nonparametric Paired"""
91
77
assert result .pvalue_wilcoxon != 'NIL'
92
78
assert result .pvalue_mann_whitney == 'NIL'
93
79
80
+ # def test_mean_within_ci_bca(mean, result):
81
+ # assert mean >= result.bca_ci_low
82
+ # assert mean <= result.bca_ci_high
83
+ #
84
+ # def test_mean_within_ci_pct(mean, result):
85
+ # assert mean >= result.pct_ci_low
86
+ # assert mean <= result.pct_ci_high
94
87
95
- @pytest .fixture
96
- def test_mean_within_ci_bca (mean , result ):
97
- assert mean >= result .bca_ci_low
98
- assert mean <= result .bca_ci_high
99
-
100
-
101
- @pytest .fixture
102
- def test_mean_within_ci_pct (mean , result ):
103
- assert mean >= result .pct_ci_low
104
- assert mean <= result .pct_ci_high
105
-
106
-
107
- @pytest .fixture
108
88
def single_samp_stat_tests (sample , result ):
109
89
110
90
assert result .is_difference == False
@@ -113,8 +93,6 @@ def single_samp_stat_tests(sample, result):
113
93
ttest_result = sp .stats .ttest_1samp (sample , 0 ).pvalue
114
94
assert result .pvalue_1samp_ttest == pytest .approx (ttest_result )
115
95
116
-
117
- @pytest .fixture
118
96
def unpaired_stat_tests (control , expt , result ):
119
97
is_difference (result )
120
98
check_pvalue_2samp_unpaired (result )
@@ -130,8 +108,6 @@ def unpaired_stat_tests(control, expt, result):
130
108
alternative = 'two-sided' ).pvalue
131
109
assert result .pvalue_mann_whitney == pytest .approx (mann_whitney_result )
132
110
133
-
134
- @pytest .fixture
135
111
def paired_stat_tests (control , expt , result ):
136
112
is_difference (result )
137
113
is_paired (result )
@@ -146,9 +122,7 @@ def paired_stat_tests(control, expt, result):
146
122
wilcoxon_result = sp .stats .wilcoxon (control , expt ).pvalue
147
123
assert result .pvalue_wilcoxon == pytest .approx (wilcoxon_result )
148
124
149
-
150
- @pytest .fixture
151
- def does_ci_captures_mean_diff (control , expt , paired , nreps = 100 , alpha = 0.05 ):
125
+ def does_ci_capture_mean_diff (control , expt , paired , nreps = 100 , alpha = 0.05 ):
152
126
if expt is None :
153
127
mean_diff = control .mean ()
154
128
else :
@@ -206,7 +180,7 @@ def test_single_sample_bootstrap(mean=100, sd=10, n=25, nreps=100, alpha=0.05):
206
180
results = bst .bootstrap (sample , alpha_level = alpha )
207
181
single_samp_stat_tests (sample , results )
208
182
209
- does_ci_captures_mean_diff (sample , None , False , nreps , alpha )
183
+ does_ci_capture_mean_diff (sample , None , False , nreps , alpha )
210
184
211
185
212
186
@@ -225,7 +199,7 @@ def test_unpaired_difference(mean=100, sd=10, n=25, nreps=100, alpha=0.05):
225
199
results = bst .bootstrap (sample1 , sample2 , paired = False , alpha_level = alpha )
226
200
unpaired_stat_tests (sample1 , sample2 , results )
227
201
228
- does_ci_captures_mean_diff (sample1 , sample2 , False , nreps , alpha )
202
+ does_ci_capture_mean_diff (sample1 , sample2 , False , nreps , alpha )
229
203
230
204
231
205
@@ -248,4 +222,4 @@ def test_paired_difference(mean=100, sd=10, n=25, nreps=100, alpha=0.05):
248
222
results = bst .bootstrap (sample1 , sample2 , alpha_level = alpha , paired = True )
249
223
paired_stat_tests (sample1 , sample2 , results )
250
224
251
- does_ci_captures_mean_diff (sample1 , sample2 , True , nreps , alpha )
225
+ does_ci_capture_mean_diff (sample1 , sample2 , True , nreps , alpha )
0 commit comments