I compare regions in DNA with structural fractures in cancer patients and healthy people. I am trying to run the Kruskal-Wallis test (SciPy Stats) on the number of breaks for each region to find out if there is a difference between the two distributions. I am not sure if the input for Kruskal-Wallis should be an array (documentation) or a list of arrays (elsewhere on the Internet).
First I tried an array for sample + control as follows:
controls = ['1', '2', '3', '4', '5']
samples = ['10', '20', '30', '40', '50']
n=0
for item in controls:
array_item = np.array([item, samples[n]])
kw_test = stats.mstats.kruskalwallis(array_item)
print(kw_test)
n+=1
This gave me the following result for all elements:
(0.0, nan)
I also tried converting individual data points into arrays and then running a KW test.
controls = ['1', '2', '3', '4', '5']
samples = ['10', '20', '30', '40', '50']
n=0
kw_results = []
for item in controls:
array_controls = np.array([item])
array_samples = np.array([samples[n]])
kw_test = stats.mstats.kruskalwallis(array_samples, array_controls)
kw_results.append(kw_test)
n+=1
print(kw_results)
This gave (1.0, 0.31731050786291404)for all comparisons, even when I changed one of the lists a lot.
, , , , ( , ) "(0.0, nan)", .
controls = ['1', '2', '3', '4', '5']
samples = ['10', '20', '30', '40', '50']
list_ = []
n=0
for item in controls:
array_item = np.array([item, samples[n]])
list_.append(array_item)
n+=1
kw_test = stats.mstats.kruskalwallis(list_)
print(kw_test)
:
TypeError: Not implemented for this type
, / , , - !