Skip to content

Commit 5f89aad

Browse files
authored
Merge pull request #330 from cosanlab/permutation_nan
use nanmean in permutation functions
2 parents 7ecfbfc + debd7f2 commit 5f89aad

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

nltools/stats.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def fdr(p, q=.05):
101101
discovery rate q. Written by Tal Yarkoni
102102
103103
Args:
104-
p: (np.array) vector of p-values (only considers non-zero p-values)
104+
p: (np.array) vector of p-values
105105
q: (float) false discovery rate level
106106
107107
Returns:
@@ -523,7 +523,7 @@ def one_sample_permutation(data, n_permute=5000, tail=2, n_jobs=-1, return_perms
523523

524524
data = np.array(data)
525525
stats = dict()
526-
stats['mean'] = np.mean(data)
526+
stats['mean'] = np.nanmean(data)
527527

528528
all_p = Parallel(n_jobs=n_jobs)(delayed(_permute_sign)(data,
529529
random_state=seeds[i]) for i in range(n_permute))
@@ -554,7 +554,7 @@ def two_sample_permutation(data1, data2, n_permute=5000,
554554
seeds = random_state.randint(MAX_INT, size=n_permute)
555555

556556
stats = dict()
557-
stats['mean'] = np.mean(data1)-np.mean(data2)
557+
stats['mean'] = np.nanmean(data1)-np.nanmean(data2)
558558
data = pd.DataFrame(data={'Values': data1, 'Group': np.ones(len(data1))})
559559
data = data.append(pd.DataFrame(data={
560560
'Values': data2,

nltools/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Specifies current version of nltools to be used by setup.py and __init__.py
22
"""
33

4-
__version__ = '0.3.14'
4+
__version__ = '0.3.15'

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
nibabel>=2.0.1
2-
scikit-learn>=0.19.1
2+
scikit-learn>=0.21.0
33
nilearn>=0.5.0
44
pandas>=0.20
55
numpy>=1.9

0 commit comments

Comments
 (0)