Skip to contents

Tests the median difference of two samples and returns the p-value from a u-test with useful default parameters and calculates the median foldchange. Returns NA if the u-test is uncalculable (i.e. does try() handling).

Usage

get.utest.p.and.medianfoldchange(x, group1, group2, paired = FALSE,
    alternative = 'two.sided', logged = TRUE);

Arguments

x

Vector of numbers to analyze

group1

Vector of TRUE/FALSE indicating which are the x samples for the u-test

group2

Vector of TRUE/FALSE indicating which are the y samples for the u-test

paired

Do a paired u-test?

alternative

What's the null-hypothesis?

logged

Indicate whether data is log-transformed or not

Details

Calculates fold-changes as median(group2)/median(group1) in normal-space and median(group2) - median(group1) in log-space, with appropriate NA-handling.

Value

Returns a two-element vector containing the p-value and fold-change, or NAs if an error occurs.

Author

Cindy Q. Yao

See also

Examples

get.utest.p.and.medianfoldchange(
  x = rnorm(100),
  group1 = c( rep(TRUE, 50), rep(FALSE, 50) ),
  group2 = c( rep(FALSE, 50), rep(TRUE, 50) ),
  logged = FALSE
  );
#> [1] 0.492754 1.753625