Skip to content

Commit ae8c004

Browse files
committed
add test to ensure ACCLAB/dabestr#48 is fixed
1 parent ff9ce04 commit ae8c004

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

dabest/tests/test_99_confint.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
def test_paired_mean_diff_ci():
2+
# See Altman et al., Statistics with Confidence:
3+
# Confidence Intervals and Statistical Guidelines (Second Edition). Wiley, 2000.
4+
# Pg 31.
5+
# Added in v0.2.5.
6+
blood_pressure = {"before": [148, 142, 136, 134, 138, 140, 132, 144,
7+
128, 170, 162, 150, 138, 154, 126, 116],
8+
"after" : [152, 152, 134, 148, 144, 136, 144, 150,
9+
146, 174, 162, 162, 146, 156, 132, 126],
10+
"subject_id" : np.arange(1, 17)}
11+
exercise_bp = pd.DataFrame(blood_pressure)
12+
13+
14+
ex_bp = load(data=exercise_bp, idx=("before", "after"),
15+
paired=True, id_col="subject_id")
16+
paired_mean_diff = ex_bp.mean_diff.results
17+
18+
assert pytest.approx(3.625) == paired_mean_diff.bca_low[0]
19+
assert pytest.approx(9.125) == paired_mean_diff.bca_high[0]
20+
21+
22+
# def test_paired_median_diff_ci():
23+
# # See Altman et al., Statistics with Confidence:
24+
# # Confidence Intervals and Statistical Guidelines (Second Edition). Wiley, 2000.
25+
# # Pg 31.
26+
# endorphin = {"before": [10.6, 5.2, 8.4, 9.0, 6.6, 4.6,
27+
# 14.1, 5.2, 4.4, 17.4, 7.2],
28+
# "after" : [14.6, 15.6, 20.2, 20.9, 24.0,
29+
# 25.0, 35.2, 30.2, 30.0, 46.2, 37.0],
30+
# "subject_id" : np.arange(1, 12)}
31+
# marathon = pd.DataFrame(endorphin)
32+
#
33+
#
34+
# endorphin_marathon = load(data=marathon, idx=("before", "after"),
35+
# paired=True, id_col="subject_id")
36+
# paired_median_diff = endorphin_marathon.median_diff.results
37+
#
38+
# assert pytest.approx(10.4) == paired_median_diff.bca_low[0]

0 commit comments

Comments
 (0)