ks.test_expl: simulation and plots explaining KS-test and Wilcox-test

Description Usage Arguments Value Author(s) Examples

View source: R/ks.test_expl.R

Description

This function generates random data (rnorm, or other provided by distr argument) or uses user-provided data to explain how KS-test and Wilcox-test measure difference in distributions. It shows empirical cumulative distribution of z-scores for a given group of genes (set) and for all other genes (other). User can compare this plot to the KS-test and the Wilcox-test results.

Usage

1
2
3
4
5
6
7
8
ks.test_expl(N_other = 1000, N_set = 100, alternative = "greater",
  z_score = 1.5, prop_pos = 0.3, prop_neg = 0, x_coor_other = -1.7,
  x_coor_set = 1.7, cex = 1.7,
  title = "Treatment: anti-Oct4 shRNA.\nOct4 is a pos. and a neg. regulator of its targets",
  xlab = "z-score, simulated", lab_other = "other genes",
  lab_set = "Oct4 targets", seed = 1, x = NULL, y = NULL,
  gener_dist = NULL, gener_dist_lab = "all genes", distr = rnorm,
  col_other = "black", col_set = "blue", ...)

Arguments

N_other

integer, size of the "other" group, ignored if x is provided

N_set

integer, size of the "set" group, ignored if y is provided

alternative

character, "greater" or "less". The choice of alternative hypothesis for KS-test ks.test. Greater tests is the set (y) distribution (or, in case of Wilcox test, it's median) is shifted to the right compated to other (x) distribution. This choice of "greater" or "less" is flipped for the Wilcox test due to difference in the null hypothesis formulation (wilcox.test).

z_score

numeric, size of the true difference

prop_pos

numeric, between 0 and 1, the fraction of "set" group that is higher than other by z_score

prop_neg

numeric, between 0 and 1, the fraction of "set" group that is lower than other by z_score

x_coor_other

numeric, x coordinate of "other" group label on the plot

x_coor_set

numeric, x coordinate of "set" group label on the plot

cex

numeric, plotting parameter, size of the group label text, axis label text and axis annotation text

title

character, title of the plot

xlab

character, x-axis label

lab_other

character, other group label

lab_set

character, set group label

seed

integer, to initialise random number generator for reproducibility

x

numeric vector, the distribution of values of the "other" group. These can come from the experimental data.

y

numeric vector, the distribution of values of the "set" group. These can come from the experimental data.

distr

function that generates a vector of random numbers of lenght n (n argument to this function). rnorm by default

col_other

color of the other distribution (passed to plot(col = )). Details plot

col_set

color of the other distribution (passed to plot(col = )). Details plot

...

other plotting parameters plot

Value

list containing the output of KS-test and Wilcox-test

Author(s)

Vitalii Kleshchevnikov

Examples

1
2
3
# Let's have a look at a TF that regulates
# some of it's targets positively, some negatively and some are not affected.
ks.test_expl(alternative = "greater", prop_pos = 0.33, prop_neg = 0.4, seed = 1, cex.main = 1.4)

vitkl/regNETcmap documentation built on Feb. 18, 2020, 3:43 a.m.