Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does scipy.stats.permutation_test really exist?

scipy documentation describes a module [scipy.stats.permutation_test].1

when I try using this module in Jupyter Notebook, as shown below, I get:

"AttributeError: module 'scipy.stats' has no attribute 'permutation_test'".

Looking at all the attributes for scipy.stats in the Notebook, permutation_test is not listed. Does the permutation_test module really exist in scipy, or is this an Anaconda distribution issue?

import numpy as np
import scipy.stats as sps

def stat_q25(x, y):
    return np.quantile(x, 0.25) - np.quantile(y, 0.25)

test_q25 = sps.permutation_test(data = (x, y), statistic = stat_q25, alternative = 'greater')
like image 908
PeterG Avatar asked Jan 19 '26 07:01

PeterG


1 Answers

Probably your python version is too low. If you update it to higher version, for example 3.8, you can install a higher version of scipy, permutation_test will be included.

I had the same issue and solved it recently.

like image 133
qzw0004 Avatar answered Jan 20 '26 19:01

qzw0004