The Kruskal–Wallis one-way analysis of variance by ranks is a non-parametric method for testing whether samples originate from the same distribution. It is used for comparing more than two samples that are independent, or not related.
Questions tagged [kruskal-wallis]
102 questions
7
votes
1 answer
ggpubr: change font size of stat_compare_means Kruskal-Wallis p-values
How can I change the font size of stat_compare_means on the plot below? I.e, change the "Kruskal-Wallis, p = 1.5e-09" and the other p-values font size? I would like to use a smaller font size than the default one...
Following the data…

guidebortoli
- 659
- 3
- 8
- 16
6
votes
2 answers
how to create a table as dunn.test output (R)?
I'm working with bacteria pyrosequencing data and I'm doing the statistical analysis with R. I have 21 samples and 7 different treatments. I loaded my data into R phyloseq obtaining:
> psR
phyloseq-class experiment-level object
otu_table() OTU…

Lidia_N
- 73
- 1
- 6
5
votes
2 answers
Kruskal - Wallis p-value matrix for data subsets with R
Consider a dataset Data which has several factor and several numerical continuous variables. Some of these variables, let's say slice_by_1 (with classes "Male", "Female") and slice_by_2 (with classes "Sad", "Neutral", "Happy"), are used to 'slice'…

GegznaV
- 4,938
- 4
- 23
- 43
5
votes
3 answers
Input format for Kruskal-Wallis test in Python
I am comparing regions in the DNA on structural breaks in cancer patients and healthy people. I am trying to run a Kruskal-Wallis test (SciPy Stats) on the number of breaks for each region, to see if there is a difference between the two…

Annevv
- 51
- 1
- 1
- 5
5
votes
1 answer
Extract p-value from Kruskal-Wallis output
Let's say I have a dataframe
> col1<-c(1,5,2,6,8,1,3,8,9,1,8)
> col2<-c(1,2,1,1,2,2,1,2,2,1,1)
> df<-data.frame(col1,col2)
> df
col1 col2
1 1 1
2 5 2
3 2 1
4 6 1
5 8 2
6 1 2
7 3 1
8 8 2
9 …

Olli J
- 649
- 2
- 7
- 23
3
votes
0 answers
Multivariate Kruskall Wallis Package in Python
I would like to investigate whether there are siginifcant differences between three different groups. There are about 20 numerical attributes for these groups. For each attribute there are about a thousand observations.
My first thought was to…

Pytno
- 57
- 5
3
votes
2 answers
R - stat_compare_means return differnt value from Kruskal-Wallis test
I want to plot the p value of Kruskal-Wallis test to my ggplot using the R function stat_compare_means from the package ggpubr.
However, the plotted value is different from the value if I simply run the function:
kruskal.test(value ~ type, data =…

DigiPath
- 179
- 2
- 10
3
votes
0 answers
How to get effect size for Kruskal Wallis test in Python?
I am trying to do Kruskal Wallis test in python that not only gives me the H statistics and the p value, but also the effect size.
I have tried scipy's stats.kruskal() function, but only the H and p were returned.
with a pandas dataframe, so I…

VeritatemAmo
- 55
- 5
3
votes
1 answer
Find and visualize best and worst items using boxplot
I am a dataset of jokes Dataset 2 (jester_dataset_2.zip) from the Jester project and I would like to divide the jokes into groups of jokes with similar rating and visualize the results appropriately.
The data look like this
>…

Slazer
- 4,750
- 7
- 33
- 60
3
votes
0 answers
r - In is.not.number.warning(x)
I have a problem to perform a kruskal wallis test with package data.table and module Terr on RStudio.
Variables :
$WL_TEST_Q1: num[1:41725]
$SPLIT: chr[1:41725]
$TEST_NUM_NAME: chr[1:41725]
Code :
setDT(DT)
KwTestQ1 <- DT[!is.na(WL_TEST_Q1),…

Laurent Cesaro
- 341
- 1
- 3
- 17
2
votes
2 answers
Add kruskall-wallis and paiwise comparisons test outputs to dataframe
I have several boxplots that I am running some statistics on through a for loop.
I want to be able to output the data into a dataframe. i.e. something like this (I've made up random numbers):
For the Kruskal-Wallis:
For the pairwise…

Melanie Baker
- 449
- 1
- 13
2
votes
1 answer
Error adding the Kruskal Wallis pvalue into boxplots with facet_grid in R
I am trying to add the Kruskal Wallis pvalue to my boxplots and although I have seen a lot of posts with the solution, I cannot make it work.
This is my data and the code to run the boxplots:
library(ggplot2)
library(dplyr)
set.seed(1234)
Gene <-…

emr2
- 1,436
- 7
- 23
2
votes
1 answer
R ggplot2: add kruskal Wallis and pairwise Wilcoxon test to boxplots with multiple groups/subgroups within each group and facet
I am trying to add kruskal Wallis and pairwise Wilcoxon test to the figure to show which groups are significant different, but I have multiple groups/subgroups within each group and facet which makes it complicated.
Here is the R code by using iris…

dolphin
- 21
- 1
- 3
2
votes
1 answer
Guidelines for specifying variables in a function
Consider dat1 created here:
set.seed(123)
dat1 <- data.frame(Region = rep(c("r1","r2"), each = 100),
State = rep(c("NY","MA","FL","GA"), each = 10),
Loc = rep(c("a","b","c","d","e","f","g","h"),each = 5),
…

Ryan
- 1,048
- 7
- 14
2
votes
0 answers
Get Kruskal-Wallis Ranks from function
I'm using Kruskal-Wallis to do some analysis on non-normal/heterskedastic data and I'm keen to use Welch's t-test implementation data as described by Cribbie et al here. Their process involves performing the Welch's T-test on the ranks from K-W. …

Alicia
- 121
- 1
- 12