same data gives different p-values for kruskal test

180 Views Asked by At

I've defined 3 variables that are " x, y and z". Tried to kruskal test these independent variables. P-Value comes out different in python and r. Have any ideas?

in python

from scipy import stats
import numpy as np
x = np.array([22.293, 23.621, 25.536, 27.322, 28.872, 30.385, 32.621, 35.111, 37.418, 39.607, 41.381, 43.107, 44.747, 46.602])

y = np.array([29.989, 30.184, 29.567, 28.403, 28.166, 28.815, 30.083, 31.520, 32.786, 33.954, 35.105, 35.959, 36.590, 37.173])

z = np.array([19.416, 19.798, 19.493, 18.797, 19.024, 19.031, 19.547, 20.246, 21.474, 22.908, 24.534, 26.458, 28.344, 30.222])
stats.kruskal(x,y,z)

KruskalResult(statistic=21.43236829615566, pvalue=2.2183003995654387e-05)

in r

library(stats)
x = c(22.293, 23.621, 25.536, 27.322, 28.872, 30.385, 32.621, 35.111, 37.418, 39.607, 41.381, 43.107, 44.747, 46.602)
y = c(29.989, 30.184, 29.567, 28.403, 28.166, 28.815, 30.083, 31.520, 32.786, 33.954, 35.105, 35.959, 36.590, 37.173)
z = c(19.416, 19.798, 19.493, 18.797, 19.024, 19.031, 19.547, 20.246, 21.474, 22.908, 24.534, 26.458, 28.344, 30.222)
kruskal.test(x,y,z)

Kruskal-Wallis rank sum test data: x y z Kruskal-Wallis chi-squared = 13, df = 13, p-value = 0.4478

0

There are 0 best solutions below