Skip to content

Commit

Permalink
Merge pull request #330 from cosanlab/permutation_nan
Browse files Browse the repository at this point in the history
use nanmean in permutation functions
  • Loading branch information
ljchang authored Mar 6, 2020
2 parents 7ecfbfc + debd7f2 commit 5f89aad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions nltools/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def fdr(p, q=.05):
discovery rate q. Written by Tal Yarkoni
Args:
p: (np.array) vector of p-values (only considers non-zero p-values)
p: (np.array) vector of p-values
q: (float) false discovery rate level
Returns:
Expand Down Expand Up @@ -523,7 +523,7 @@ def one_sample_permutation(data, n_permute=5000, tail=2, n_jobs=-1, return_perms

data = np.array(data)
stats = dict()
stats['mean'] = np.mean(data)
stats['mean'] = np.nanmean(data)

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

stats = dict()
stats['mean'] = np.mean(data1)-np.mean(data2)
stats['mean'] = np.nanmean(data1)-np.nanmean(data2)
data = pd.DataFrame(data={'Values': data1, 'Group': np.ones(len(data1))})
data = data.append(pd.DataFrame(data={
'Values': data2,
Expand Down
2 changes: 1 addition & 1 deletion nltools/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Specifies current version of nltools to be used by setup.py and __init__.py
"""

__version__ = '0.3.14'
__version__ = '0.3.15'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nibabel>=2.0.1
scikit-learn>=0.19.1
scikit-learn>=0.21.0
nilearn>=0.5.0
pandas>=0.20
numpy>=1.9
Expand Down

0 comments on commit 5f89aad

Please sign in to comment.