Compute feature-wise absolute difference penalty

Compute t-stat absolute difference penalty

colmeans_penalty(x1, x2)

p_transform(penalty)

tstat_penalty(x1, x2, y1, y2)

ks_penalty(x1, x2, statistic = TRUE)

Arguments

x1

A data matrix

x2

A data matrix

penalty

A vector of penalties to be transformed where the sum is set to the length of the vector

y1

A factor response corresponding to the columns of x1

y2

A factor response corresponding to the columns of x2

statistic

Should the KS-test statistic be returned (default) or the p-value should be returned. Logical.

Value

A vector A vector A vector of length matching that of x1 and x2

Examples

n = 20
p = 5
x1 = matrix(rnorm(n * p, mean = 0, sd = 1), nrow = n, ncol = p)
x2 = matrix(rnorm(n * p, mean = 1, sd = 1), nrow = n, ncol = p)
colmeans_penalty(x1, x2)
#> [1] 1.0417872 1.5842330 0.6572764 0.4263294 1.2903740
n = 20
p = 5
x1 = matrix(rnorm(n * p, mean = 0, sd = 1), nrow = n, ncol = p)
y1 = factor(rbinom(n, 1, prob = 0.5), levels = c("0", "1"))
x2 = matrix(rnorm(n * p, mean = 1, sd = 1), nrow = n, ncol = p)
y2 = factor(rbinom(n, 1, prob = 0.5), levels = c("0", "1"))
tstat_penalty(x1 = x1, x2 = x2, y1 = y1, y2 = y2)
#> [1] 1.53175612 0.04074133 0.47832180 1.59416583 1.35501492
n = 20
p = 5
x1 = matrix(rnorm(n * p, mean = 0, sd = 1), nrow = n, ncol = p)
y1 = factor(rbinom(n, 1, prob = 0.5), levels = c("0", "1"))
x2 = matrix(rnorm(n * p, mean = 1, sd = 1), nrow = n, ncol = p)
y2 = factor(rbinom(n, 1, prob = 0.5), levels = c("0", "1"))
ks_penalty(x1 = x1, x2 = x2)
#> [1] 0.55 0.25 0.70 0.35 0.55