Skip to content

Commit d61e354

Browse files
author
javier
committed
import scipy
1 parent 4145a0c commit d61e354

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Mann-Kandall-test.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
################################################################################
1010

1111
import numpy as np
12+
from scipy import stats
1213

1314
def mk_test(x, alpha=0.05):
1415

@@ -40,7 +41,7 @@ def mk_test(x, alpha=0.05):
4041
z = (s + 1) / np.sqrt(var_s)
4142

4243
# calculate the p_value
43-
p = 2 * (1 - scipy.stats.norm.cdf(abs(z))) # two tail test
44-
h = abs(z) > scipy.stats.norm.ppf(1 - alpha / 2)
44+
p = 2 * (1 - stats.norm.cdf(abs(z))) # two tail test
45+
h = abs(z) > stats.norm.ppf(1 - alpha / 2)
4546

4647
return h, p

0 commit comments

Comments
 (0)