kruskal-wallis

R Kruskal-Wallis with multiple factors

。_饼干妹妹 提交于 2021-02-16 14:52:38
问题 I'm looking for help on performing the Kruskal-Wallis test on my set of data for a large number of factors. I can perform the test for a single factor, like AD_1yr: kruskal.test(Shannon ~ AD_1y, data=comm) But I have over 50 factors I want to test, and was hoping there is a code I can enter that will perform the test for all the factors without having to manually perform the test 50 different times. 回答1: We can use lapply to loop over the factor columns, create a data.frame with the 'shannon'

ggpubr: change font size of stat_compare_means Kruskal-Wallis p-values

淺唱寂寞╮ 提交于 2021-02-07 07:52:19
问题 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 example... library(ggpubr) data("ToothGrowth") compare_means(len ~ dose, data = ToothGrowth) # Visualize: Specify the comparisons I want my_comparisons <- list( c("0.5", "1"), c("1", "2"), c("0.5", "2") ) # Plotting ggboxplot(ToothGrowth, x = "dose", y = "len",

create vectors for Kruskal-Wallis H-test python

与世无争的帅哥 提交于 2020-01-06 03:03:26
问题 I have dataset as below df = pd.DataFrame({'numbers':range(9), 'group':['a', 'b', 'c']*3}) group numbers 0 a 0 1 b 1 2 c 2 3 a 3 4 b 4 5 c 5 6 a 6 7 b 7 8 c 8 i want to create vectors a = [0, 3, 6] b = [1, 4, 7] c = [2, 5, 8] for Kruskal-Wallis H-test python stats.kruskal(a, b, c) or maybe analogue as in R (numbers ~ group) 回答1: I'm not familiar with any special requirements of the Kruskal-Wallis test, but you can access these grouped arrays via by putting them into a dictionary this way:

R: Kruskal-Wallis test in loop over specified columns in data frame

主宰稳场 提交于 2020-01-04 05:19:15
问题 I would like to run a KW-test over certain numerical variables from a data frame, using one grouping variable. I'd prefer to do this in a loop, instead of typing out all the tests, as they are many variables (more than in the example below). Simulated data: library(dplyr) set.seed(123) Data <- tbl_df( data.frame( muttype = as.factor(rep(c("missense", "frameshift", "nonsense"), each = 80)), ados.tsc = runif(240, 0, 10), ados.sa = runif(240, 0, 10), ados.rrb = runif(240, 0, 10)) ) %>% group_by