Skip to content

Commit 8aff220

Browse files
authored
Merge pull request #202 from ACCLAB/pooled-variance-fix
Fix pooled variance calculation
2 parents 06bb741 + 07b08be commit 8aff220

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# DABEST-Python
2-
1+
DABEST-Python
2+
================
33

44
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
55

dabest/_stats_tools/confint_2group_diff.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ def compute_interval_limits(bias, acceleration, n_boots, ci=95):
314314

315315
@njit(cache=True)
316316
def calculate_group_var(control_var, control_N, test_var, test_N):
317-
return control_var / control_N + test_var / test_N
317+
318+
pooled_var = ((control_N - 1) * control_var + (test_N - 1) * test_var) / (control_N + test_N - 2)
319+
320+
return pooled_var
318321

319322

320323
def calculate_weighted_delta(group_var, differences):

nbs/API/confint_2group_diff.ipynb

+4-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,10 @@
368368
"\n",
369369
"@njit(cache=True)\n",
370370
"def calculate_group_var(control_var, control_N, test_var, test_N):\n",
371-
" return control_var / control_N + test_var / test_N\n",
371+
" \n",
372+
" pooled_var = ((control_N - 1) * control_var + (test_N - 1) * test_var) / (control_N + test_N - 2) \n",
373+
" \n",
374+
" return pooled_var\n",
372375
"\n",
373376
"\n",
374377
"def calculate_weighted_delta(group_var, differences):\n",

0 commit comments

Comments
 (0)