Scipy – Ks2samps statistic location
Question:
I follow this official doc to conduct the two-sample Kolmogorov-Smirnov test. I would like to ask how to get the statistic_location
(i.e., the location of maximum difference between the two CDFs). In the documentation, it specifies that the ks_2samp
function can return the statistic_location
but in fact it only returns the statistic
and pvalue
.
For example:
import numpy as np
from scipy import stats
n1 = np.random.normal(0,1,20)
n2 = np.random.normal(1,1,20)
stats.ks_2samp(n1,n2)
The result is:
KstestResult(statistic=0.55, pvalue=0.00396729438660086)
Answers:
Verify SciPy version is >= v1.10. location_statistics
and statistic_sign
were added to the result of ks_2samp()
in version 1.10. Source: https://github.com/scipy/scipy/pull/17062
I follow this official doc to conduct the two-sample Kolmogorov-Smirnov test. I would like to ask how to get the statistic_location
(i.e., the location of maximum difference between the two CDFs). In the documentation, it specifies that the ks_2samp
function can return the statistic_location
but in fact it only returns the statistic
and pvalue
.
For example:
import numpy as np
from scipy import stats
n1 = np.random.normal(0,1,20)
n2 = np.random.normal(1,1,20)
stats.ks_2samp(n1,n2)
The result is:
KstestResult(statistic=0.55, pvalue=0.00396729438660086)
Verify SciPy version is >= v1.10. location_statistics
and statistic_sign
were added to the result of ks_2samp()
in version 1.10. Source: https://github.com/scipy/scipy/pull/17062