r - Improper p-value for Kruskal Wallis test; possibly related to NA values? -
i trying perform kruskal-wallis test between 2 columns in dataframe when saw that, if compare column itself, not p-value of 1:
controlvcontrol<- kruskal.test(neurite.5rgd[,1], neurite.5rgd[,1], na.rm=true) controlvcontrol$p.value [1] 7.967453e-99
same thing happens if compare 2 different columns hold identical data:
(1:length(neurite.5rgd[,1]))[which((neurite.5rgd[,1]-neurite.5rgd[,3])!=0)] integer(0) > controlvbdnf<- kruskal.test(neurite.5rgd[,1], neurite.5rgd[,3], na.rm=t) > controlvbdnf$p.value [1] 7.967453e-99
i figured due na values in columns, tried simple example:
> x <- c(1, 2, 3, 4,5, na, na) > y <- c(1, 2, 3, 4,5, na, na) > krus <- kruskal.test(x,y, na.rm = true) > krus$p.value [1] 0.4060058 > ttest <- t.test(x,y, na.rm=t) > ttest$p.value [1] 1
can tell me i'm doing wrong?
Comments
Post a Comment