I have a dataframe with the following structure
> str(mydata12)
'data.frame': 228459 obs. of 2 variables:
$ intron_length: num 0.787 0.799 2.311 2.396 1.77 ...
$ intron_type : Factor w/ 3 levels "All_intron","All_retained_intron",..: 1 1 1 1 1 1 1 1 1 1 ...
I used ggplot2 to analyze the accumulation density
p <- ggplot(mydata12, aes(x = intron_length, color=intron_type)) + geom_step(aes(y=..y..),stat="ecdf")
It gives me good lines. Now I want to make a comparison between the lines.
My question is what the proper way to get a P value between the 3 lines?
I have tried:
> compare_means(intron_length~intron_type, data = mydata12)
A tibble: 3 x 8
.y. group1 group2 p p.adj p.format p.signif method
<chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr>
1 intron_length All_intron All_retained_intron 0. 0. <2e-16 * Wilcoxon
2 intron_length All_intron dynamic_intron 0. 0. <2e-16 * Wilcoxon
3 intron_length All_retained_intron dynamic_intron 1.42e-79 1.40e-79 <2e-16 ** Wilcoxon
> my_comparisons <- list(c("All_intron", "All_retained_intron"), c("All_intron", "dynamic_intron"), c("All_retained_intron", "dynamic_intron"))
> p + stat_compare_means(comparisons = my_comparisons)
Error in f(...) : Can only handle data with groups that are plotted on the x-axis
I have been thinking about getting the slope of the line and make a comparison, is it right and if yes, how can I do it?
Thanks,